|
@@ -26,6 +26,7 @@ export default class CusVideo extends React.Component {
|
|
|
super(props);
|
|
|
this.pressStatus = false;
|
|
|
this.progress = 0;
|
|
|
+ this.time_hideController;
|
|
|
}
|
|
|
config = {
|
|
|
changeX: 0,
|
|
@@ -99,11 +100,11 @@ export default class CusVideo extends React.Component {
|
|
|
onLoadStart={this.loadStart} // 当视频开始加载时的回调函数
|
|
|
onLoad={this.onLoad} //加载媒体并准备播放时调用的回调函数。
|
|
|
onProgress={this.onProgress} //视频播放过程中每个间隔进度单位调用的回调函数
|
|
|
- onEnd={this.onEnd} //视频播放结束时的回调函数
|
|
|
onAudioBecomingNoisy={this.onAudioBecomingNoisy} //音频变得嘈杂时的回调 - 应暂停视频
|
|
|
onAudioFocusChanged={this.onAudioFocusChanged} //音频焦点丢失时的回调 - 如果焦点丢失则暂停
|
|
|
repeat={this.state.wheel} //确定在到达结尾时是否重复播放视频。
|
|
|
- onError={this.onError} // 当视频不能加载,或出错后的回调函数
|
|
|
+ onError={this.onError.bind(this)} // 当视频不能加载,或出错后的回调函数
|
|
|
+ onEnd={this.onEnd.bind(this)} //视频播放结束时的回调函数
|
|
|
playInBackground={false} // 当app转到后台运行的时候,播放是否暂停
|
|
|
playWhenInactive={true} // [iOS] Video continues to play when control or notification center are shown. 仅适用于IOS
|
|
|
/>
|
|
@@ -159,11 +160,9 @@ export default class CusVideo extends React.Component {
|
|
|
} else {
|
|
|
this.showController();
|
|
|
}
|
|
|
- console.log("onPanResponderGrant");
|
|
|
},
|
|
|
onPanResponderStart: (evt, gestureState) => {
|
|
|
this.pressStatus = true;
|
|
|
- console.log("onPanResponderStart");
|
|
|
},
|
|
|
onPanResponderMove: (evt, gestureState) => {
|
|
|
this.config.yDiff = evt.nativeEvent.pageY - this.config.changeY;
|
|
@@ -173,7 +172,6 @@ export default class CusVideo extends React.Component {
|
|
|
},
|
|
|
onPanResponderEnd: (evt, gestureState) => {
|
|
|
this.pressStatus = true;
|
|
|
- console.log("onPanResponderEnd");
|
|
|
},
|
|
|
onPanResponderTerminationRequest: (evt, gestureState) => true,
|
|
|
onPanResponderRelease: (evt, gestureState) => {
|
|
@@ -191,6 +189,16 @@ export default class CusVideo extends React.Component {
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
+ if (this.state.show_controller) {
|
|
|
+ this.time_hideController = setTimeout(() => {
|
|
|
+ this.setState({
|
|
|
+ show_controller: false
|
|
|
+ // needback: false
|
|
|
+ });
|
|
|
+ this.bottomcontroller.setBottom(-50);
|
|
|
+ this.topcontroller.setTop(-50);
|
|
|
+ }, 5000);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
loadStart() {
|
|
@@ -202,7 +210,6 @@ export default class CusVideo extends React.Component {
|
|
|
this.setState({
|
|
|
show_loading: isBuffering
|
|
|
});
|
|
|
- console.log("isBuffering:" + isBuffering);
|
|
|
}
|
|
|
onLoad = data => {
|
|
|
//获取的是秒数
|
|
@@ -220,10 +227,10 @@ export default class CusVideo extends React.Component {
|
|
|
};
|
|
|
|
|
|
onError() {
|
|
|
- alert("播放器异常");
|
|
|
+ this.props.onError();
|
|
|
}
|
|
|
onEnd() {
|
|
|
- alert("播放结束");
|
|
|
+ this.props.onEnd();
|
|
|
}
|
|
|
play() {
|
|
|
//controller的play点击无法换图...
|
|
@@ -280,6 +287,7 @@ export default class CusVideo extends React.Component {
|
|
|
duration: 0,
|
|
|
currentTime: 0
|
|
|
});
|
|
|
+ this.bottomcontroller.setProgress(0);
|
|
|
}
|
|
|
|
|
|
videoBackClick() {
|
|
@@ -293,12 +301,22 @@ export default class CusVideo extends React.Component {
|
|
|
}
|
|
|
}
|
|
|
showController() {
|
|
|
+ clearTimeout(this.time_hideController);
|
|
|
this.setState({
|
|
|
show_controller: true
|
|
|
// needback: this.props.needback
|
|
|
});
|
|
|
this.bottomcontroller.setBottom(0);
|
|
|
+ this.bottomcontroller.setProgress(this.state.currentTime);
|
|
|
this.topcontroller.setTop(0);
|
|
|
+ this.time_hideController = setTimeout(() => {
|
|
|
+ this.setState({
|
|
|
+ show_controller: false
|
|
|
+ // needback: false
|
|
|
+ });
|
|
|
+ this.bottomcontroller.setBottom(-50);
|
|
|
+ this.topcontroller.setTop(-50);
|
|
|
+ }, 5000);
|
|
|
}
|
|
|
hideController() {
|
|
|
this.setState({
|
|
@@ -413,7 +431,6 @@ class Loading extends Component {
|
|
|
}
|
|
|
|
|
|
changeIndex() {
|
|
|
- console.log("this.loading_index :" + this.loading_index);
|
|
|
setTimeout(() => {
|
|
|
if (this.loading_index > this.props.loading_arr.length - 2) {
|
|
|
this.loading_index = 0;
|