|
@@ -11,6 +11,7 @@ import {
|
|
|
} from "react-native";
|
|
|
import { createStackNavigator, createAppContainer } from "react-navigation";
|
|
|
import Video from "react-native-video";
|
|
|
+import SeekBar from "../components/SeekBar";
|
|
|
const instructions = Platform.select({
|
|
|
ios: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu",
|
|
|
android:
|
|
@@ -45,6 +46,7 @@ export default class CusVideo extends React.Component {
|
|
|
|
|
|
resizeMode={this.state.resizeMode}
|
|
|
|
|
|
+ onBuffer={this.onBuffer}
|
|
|
rate={this.state.rate}
|
|
|
paused={this.state.paused}
|
|
|
volume={this.state.volume}
|
|
@@ -93,20 +95,16 @@ export default class CusVideo extends React.Component {
|
|
|
<View
|
|
|
style={{
|
|
|
flex: 7,
|
|
|
- backgroundColor: "yellow"
|
|
|
+ overflow: "hidden"
|
|
|
}}
|
|
|
>
|
|
|
{}
|
|
|
- {
|
|
|
- style={{
|
|
|
- flex: 1,
|
|
|
- alignItems: "center",
|
|
|
- justifyContent: "center",
|
|
|
- width: "100%"
|
|
|
- }}
|
|
|
- max={this.state.duration}
|
|
|
- progress={this.state.currentTime}
|
|
|
- /> */}
|
|
|
+ <SeekBar
|
|
|
+ style={{ flex: 1 }}
|
|
|
+ ref={view => (this.seekbar = view)}
|
|
|
+
|
|
|
+ touchUpCallBack={this.touch_up_callback.bind(this)}
|
|
|
+ />
|
|
|
</View>
|
|
|
<View style={{ flex: 3 }}>
|
|
|
{}
|
|
@@ -131,14 +129,20 @@ export default class CusVideo extends React.Component {
|
|
|
loadStart() {
|
|
|
|
|
|
}
|
|
|
+ onBuffer({ isBuffering }: { isBuffering: boolean }) {
|
|
|
+
|
|
|
+ console.log("isBuffering:" + isBuffering);
|
|
|
+ }
|
|
|
onLoad = data => {
|
|
|
|
|
|
this.setState({ duration: data.duration });
|
|
|
+ this.seekbar.setMax(data.duration);
|
|
|
};
|
|
|
onProgress = data => {
|
|
|
this.setState({
|
|
|
currentTime: data.currentTime
|
|
|
});
|
|
|
+ this.seekbar.setProgress(this.state.currentTime);
|
|
|
};
|
|
|
|
|
|
onError() {
|
|
@@ -166,10 +170,23 @@ export default class CusVideo extends React.Component {
|
|
|
|
|
|
ToastExample.show(params, ToastExample.SHORT);
|
|
|
}
|
|
|
+ seekTo(progress) {
|
|
|
+ this.player.seek(progress);
|
|
|
+ }
|
|
|
presentFullscreenPlayer() {
|
|
|
|
|
|
this.props.videofullScreenPlayer();
|
|
|
-
|
|
|
+ console.log("currentTime:" + this.state.currentTime);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.seekbar.setProgress(this.state.currentTime);
|
|
|
+ }, 10);
|
|
|
+ }
|
|
|
+ touch_up_callback(progress) {
|
|
|
+
|
|
|
+ this.setState({
|
|
|
+ currentTime: progress
|
|
|
+ });
|
|
|
+ this.seekTo(progress);
|
|
|
}
|
|
|
|
|
|
refreshVideo() {
|