push listener fix

This commit is contained in:
Ayushya Amitabh
2020-05-06 14:37:05 -04:00
parent 67e89b35e5
commit f0e72945f3
+20 -2
View File
@@ -29,12 +29,30 @@ export default class VideoListener {
Show Name: ${this.video.showName}\n Show Name: ${this.video.showName}\n
Updating: ${this.isUpdating} Updating: ${this.isUpdating}
`); `);
if (this.server.status !== this.video.status) { if (
if (this.video.showName && !this.isUpdating) this.listener(this.video); this.server.status !== this.video.status ||
Math.abs(this.server.time - this.video.element.currentTime) > 2
) {
if (
this.video.showName &&
!this.isUpdating &&
(Math.abs(this.server.time - this.video.element.currentTime) > 2 ||
this.server.status !== this.video.status)
) {
this.listener(this.video);
}
} }
} }
doUpdate(serverPlayer) { doUpdate(serverPlayer) {
this.server = serverPlayer; this.server = serverPlayer;
console.log(`
Server Status: ${this.server.status}\n
Video Status: ${this.video.status}\n
Show Name: ${this.video.showName}\n
Updating: ${this.isUpdating}
`);
if (!this.isUpdating) { if (!this.isUpdating) {
this.isUpdating = true; this.isUpdating = true;
if (serverPlayer.updatedBy === window.localStorage.getItem('watchPartyUserUid')) { if (serverPlayer.updatedBy === window.localStorage.getItem('watchPartyUserUid')) {