added a delay to seeking state reset
This commit is contained in:
parent
cafada6ede
commit
1aa03edf6e
1 changed files with 6 additions and 2 deletions
|
@ -41,7 +41,8 @@ class MediaPlayer extends React.PureComponent {
|
||||||
controlsTimeout: -1,
|
controlsTimeout: -1,
|
||||||
seekerOffset: 0,
|
seekerOffset: 0,
|
||||||
seekerPosition: 0,
|
seekerPosition: 0,
|
||||||
firstPlay: true
|
firstPlay: true,
|
||||||
|
seekTimeout: -1
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,6 +177,9 @@ class MediaPlayer extends React.PureComponent {
|
||||||
|
|
||||||
onPanResponderGrant: (evt, gestureState) => {
|
onPanResponderGrant: (evt, gestureState) => {
|
||||||
this.clearControlsTimeout();
|
this.clearControlsTimeout();
|
||||||
|
if (this.state.seekTimeout > 0) {
|
||||||
|
clearTimeout(this.state.seekTimeout);
|
||||||
|
}
|
||||||
this.setState({ seeking: true });
|
this.setState({ seeking: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -191,7 +195,7 @@ class MediaPlayer extends React.PureComponent {
|
||||||
this.onEnd();
|
this.onEnd();
|
||||||
} else {
|
} else {
|
||||||
this.seekTo(time);
|
this.seekTo(time);
|
||||||
this.setState({ seeking: false });
|
this.setState({ seekTimeout: setTimeout(() => { this.setState({ seeking: false }); }, 100) });
|
||||||
}
|
}
|
||||||
this.hidePlayerControls();
|
this.hidePlayerControls();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue