v1.1.0-beta/version update, play err catch

This commit is contained in:
Ayushya Amitabh
2020-05-11 12:25:52 -04:00
parent 0539af91c3
commit 2de32eccfd
4 changed files with 22 additions and 5 deletions
+3
View File
@@ -97,6 +97,9 @@ export default class Chat extends Component {
// DONE WITH MOUNTING TASKS
this.props.updateLoading(false);
}
componentWillUnmount() {
this.mVideoListener.end();
}
videoEventListener(video) {
this.syncPlayer(video);
}
+13 -2
View File
@@ -62,7 +62,10 @@ export default class VideoListener {
window.postMessage({ type: 'SEEK', time: serverPlayer.time * 1000 }, '*');
break;
case PLAYER_SOURCE.AMAZON:
if (this.video.status === PLAYER_STATUS.PAUSED) await this.video.element.play();
if (this.video.status === PLAYER_STATUS.PAUSED)
await this.video.element
.play()
.catch((err) => console.error('WatchParty erred when syncing time.'));
this.video.element.currentTime = serverPlayer.time;
await this.timeout(500);
break;
@@ -80,7 +83,9 @@ export default class VideoListener {
await this.video.element.pause();
break;
case PLAYER_STATUS.PLAYING:
await this.video.element.play();
await this.video.element
.play()
.catch((err) => console.error('WatchParty erred when syncing play.'));
break;
default:
break;
@@ -246,4 +251,10 @@ export default class VideoListener {
break;
}
}
end() {
if (this.video.element) {
this.video.element.removeEventListener('playing', this.onplay);
this.video.element.removeEventListener('pause', this.onpause);
}
}
}