Skip to content

Commit

Permalink
fix(component): Fixed MediaPlayer setTimeout bug
Browse files Browse the repository at this point in the history
  • Loading branch information
myxvisual committed Jun 23, 2017
1 parent 39ee3f5 commit 75a094a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/MediaPlayer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export class MediaPlayer extends React.Component<MediaPlayerProps, MediaPlayerSt
rootElm: HTMLDivElement;
showControlTimer: any = null;
mouseMoveTimer: any = null;
endTimer: any = null;
reactPlayer: any;

static contextTypes = { theme: PropTypes.object };
Expand All @@ -202,6 +203,10 @@ export class MediaPlayer extends React.Component<MediaPlayerProps, MediaPlayerSt
document.removeEventListener("mozfullscreenchange", this.exitFullScreen, false);
document.removeEventListener("fullscreenchange", this.exitFullScreen, false);
document.removeEventListener("MSFullscreenChange", this.exitFullScreen, false);

clearTimeout(this.mouseMoveTimer);
clearTimeout(this.showControlTimer);
clearTimeout(this.endTimer);
}

componentWillUpdate() {
Expand Down Expand Up @@ -307,7 +312,7 @@ export class MediaPlayer extends React.Component<MediaPlayerProps, MediaPlayerSt
}

handleEnded = () => {
setTimeout(() => {
this.endTimer = setTimeout(() => {
this.setState({
currPlaying: false,
currShowControl: true,
Expand Down

0 comments on commit 75a094a

Please sign in to comment.