Skip to content

Commit

Permalink
fix: bad seek time on iOS safari
Browse files Browse the repository at this point in the history
  • Loading branch information
mondaychen committed Jul 24, 2019
1 parent 13e6747 commit 19efac4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/components/Slider.js
Expand Up @@ -101,6 +101,10 @@ export default class Slider extends Component {
}

handleMouseUp(event) {
// On iOS safari, a subsequent mouseup event will be fired after touchend.
// Its weird event positions make the player seek a wrong time.
// calling preventDefault (at touchend phase) will prevent the mouseup event
event.preventDefault();
const { onMouseUp } = this.props;

document.removeEventListener('mousemove', this.handleMouseMove, true);
Expand Down
6 changes: 2 additions & 4 deletions src/components/control-bar/SeekBar.js
Expand Up @@ -85,16 +85,14 @@ export default class SeekBar extends Component {

render() {
const {
player: {
currentTime, seekingTime, duration, buffered
},
player: { currentTime, seekingTime, duration, buffered },
mouseTime
} = this.props;
const time = seekingTime || currentTime;

return (
<Slider
ref={(input) => {
ref={input => {
this.slider = input;
}}
label="video progress bar"
Expand Down

0 comments on commit 19efac4

Please sign in to comment.