From 385f69d839834c18426c5b3b4caad42dc2e242ed Mon Sep 17 00:00:00 2001 From: Ayushya Amitabh Date: Wed, 12 May 2021 16:05:07 -0400 Subject: [PATCH] v1.7.12/release --- admin/package.json | 2 +- app/package.json | 2 +- app/public/background.js | 2 +- app/public/manifest.json | 2 +- app/src/App.js | 2 +- app/src/Tutorial.js | 2 +- app/src/VideoListener.js | 203 +++++++--------- app/src/index.js | 10 + functions/package-lock.json | 2 +- functions/package.json | 2 +- package.json | 2 +- website/changes/index.html | 3 + website/changes/v1.7.12/index.html | 370 +++++++++++++++++++++++++++++ website/styles/dynamic.css | 0 14 files changed, 472 insertions(+), 132 deletions(-) create mode 100644 website/changes/v1.7.12/index.html create mode 100644 website/styles/dynamic.css diff --git a/admin/package.json b/admin/package.json index a07781d..156f6ec 100644 --- a/admin/package.json +++ b/admin/package.json @@ -1,6 +1,6 @@ { "name": "watch-party-admin", - "version": "1.7.11", + "version": "1.7.12", "private": true, "devDependencies": { "@ant-design/icons": "^4.2.2", diff --git a/app/package.json b/app/package.json index 5a16680..53ab85a 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "watch-party-crx", - "version": "1.7.11", + "version": "1.7.12", "private": true, "dependencies": {}, "scripts": { diff --git a/app/public/background.js b/app/public/background.js index 9d71827..3175dc4 100644 --- a/app/public/background.js +++ b/app/public/background.js @@ -26,7 +26,7 @@ try { console.info("CHROME ENV"); } -const APP_VERSION = "1.7.11"; +const APP_VERSION = "1.7.12"; const firebaseConfig = { apiKey: "AIzaSyCJLuYpzXLDRmu2ttzFuSGmYcpFxqToWFU", diff --git a/app/public/manifest.json b/app/public/manifest.json index b942e97..d2b8755 100644 --- a/app/public/manifest.json +++ b/app/public/manifest.json @@ -1,7 +1,7 @@ { "name": "Watch Party", "short_name": "WP", - "version": "1.7.11", + "version": "1.7.12", "description": "Watch streamed content together.", "background": { "page": "background.html" diff --git a/app/src/App.js b/app/src/App.js index 40746db..7758cfa 100644 --- a/app/src/App.js +++ b/app/src/App.js @@ -32,7 +32,7 @@ import { } from "./Api"; import Tutorial from "./Tutorial"; -const APP_VERSION = "1.7.11"; +const APP_VERSION = "1.7.12"; const darkTheme = createMuiTheme({ palette: { diff --git a/app/src/Tutorial.js b/app/src/Tutorial.js index 3850b9c..0ee6ef8 100644 --- a/app/src/Tutorial.js +++ b/app/src/Tutorial.js @@ -48,7 +48,7 @@ export default class Tutorial extends Component {
Resize - Use this little tab 👉 to resize the + Use this little tab 👉 to resize the sidebar, double click on it to resize to the default width
diff --git a/app/src/VideoListener.js b/app/src/VideoListener.js index 9420e33..50055b0 100644 --- a/app/src/VideoListener.js +++ b/app/src/VideoListener.js @@ -137,10 +137,10 @@ export default class VideoListener { case PLAYER_SOURCE.VIMEO: case PLAYER_SOURCE.DAILYMOTION: case PLAYER_SOURCE.PARAMOUNTPLUS: + case PLAYER_SOURCE.PEACOCK: this.video.element.currentTime = serverPlayer.time; await this.timeout(500); break; - case PLAYER_SOURCE.PEACOCK: case PLAYER_SOURCE.CRUNCHYROLL: case PLAYER_SOURCE.FUNIMATION: case PLAYER_SOURCE.ROOSTERTEETH: @@ -160,7 +160,6 @@ export default class VideoListener { // TOGGLE PLAYER STATUS if ( PLAYER_SOURCE.CRUNCHYROLL === this.video.source || - PLAYER_SOURCE.PEACOCK === this.video.source || PLAYER_SOURCE.FUNIMATION === this.video.source || PLAYER_SOURCE.ROOSTERTEETH === this.video.source ) { @@ -277,6 +276,7 @@ export default class VideoListener { } } } + return null; case PLAYER_SOURCE.STAN: const stanShowContainer = document.querySelector(nS.show); const stanEpisodeContainer = document.querySelector(nS.episode); @@ -370,40 +370,30 @@ export default class VideoListener { const seekInjectScript = document.createElement("script"); seekInjectScript.text = seekInject; document.head.appendChild(seekInjectScript); - const netflixVideoElement = document.querySelector(vS); - if (netflixVideoElement && !this.video.element) { - this.firstTimeSync(netflixVideoElement); - } else { - setInterval(() => { - var nve = document.querySelector(vS); - if ( - nve !== null && - (this.video.element !== nve || this.video.element === null) - ) { - this.firstTimeSync(nve); - } - }, 1000); - } + setInterval(() => { + var nve = document.querySelector(vS); + if ( + nve !== null && + (this.video.element !== nve || this.video.element === null) + ) { + this.firstTimeSync(nve); + } + }, 1000); break; case PLAYER_SOURCE.HULU: const huluSeekInject = `window.seekScriptLoaded=!0;var getVideoPlayer=function(){var e=document.querySelector("${vS}").__HuluDashPlayer__;return e;},seekInteraction=function(e){if(e.source==window){if(e.data.type&&"SEEK"==e.data.type){getVideoPlayer().seek(e.data.time,e.data.time);}if(e.data.type&&e.data.type==="PAUSE"){getVideoPlayer().pause();}if(e.data.type&&e.data.type==="PLAY"){getVideoPlayer().play();}e.data.type&&"teardown"==e.data.type&&(window.removeEventListener("message",seekInteraction,!1),window.seekScriptLoaded=!1)}};window.addEventListener("message",seekInteraction,!1);`; const huluSeekInjectScript = document.createElement("script"); huluSeekInjectScript.text = huluSeekInject; document.head.appendChild(huluSeekInjectScript); - const huluVideoElement = document.querySelector(vS); - if (huluVideoElement) { - this.firstTimeSync(huluVideoElement); - } else { - setInterval(() => { - var hve = document.querySelector(vS); - if ( - hve !== null && - (this.video.element !== hve || this.video.element === null) - ) { - this.firstTimeSync(hve); - } - }, 1000); - } + setInterval(() => { + var hve = document.querySelector(vS); + if ( + hve !== null && + (this.video.element !== hve || this.video.element === null) + ) { + this.firstTimeSync(hve); + } + }, 1000); break; case PLAYER_SOURCE.HBONOW: case PLAYER_SOURCE.HBOMAX: @@ -411,80 +401,57 @@ export default class VideoListener { const hboSeekInjectScript = document.createElement("script"); hboSeekInjectScript.text = hboSeekInject; document.head.appendChild(hboSeekInjectScript); - const hboVideoElement = document.querySelector(vS); - if (hboVideoElement) { - this.firstTimeSync(hboVideoElement); - } else { - setInterval(() => { - var hve = document.querySelector(vS); - if ( - hve !== null && - hve !== undefined && - (this.video.element !== hve || this.video.element === null) - ) { - this.firstTimeSync(hve); - } - }, 1000); - } + setInterval(() => { + var hve = document.querySelector(vS); + if ( + hve !== null && + hve !== undefined && + (this.video.element !== hve || this.video.element === null) + ) { + hve.classList.add('hbo-player'); + this.firstTimeSync(hve); + } + }, 1000); break; case PLAYER_SOURCE.PEACOCK: - const peacockInject = `var watchPartyInteraction=function(e){if(e.source===window){const data=JSON.parse(e.data);const playerReactElement=document.querySelector("${vS}");if(data.watchPartyDirection==='TO_SCRIPT'){if(data.type==='WATCH_PARTY_SEEK'){if(playerReactElement&&playerReactElement.player){playerReactElement.player.seek(data.time)}}else if(data.type==='WATCH_PARTY_STATUS'){if(playerReactElement&&playerReactElement.player){if(data.status==='PAUSED')playerReactElement.player.pause();if(data.status==='PLAYING')playerReactElement.player.play()}}}}};window.addEventListener("message",watchPartyInteraction);`; - const peacockInjectScript = document.createElement("script"); - peacockInjectScript.text = peacockInject; - document.head.appendChild(peacockInjectScript); - const peacockVideoElement = document.querySelector(vS); - if (peacockVideoElement) { - this.firstTimeSync(peacockVideoElement); - } else { - setInterval(() => { - var pve = document.querySelector(vS); - if ( - pve !== null && - pve !== undefined && - (this.video.element !== pve || this.video.element === null) - ) { - this.firstTimeSync(pve); - } - }, 1000); - } + setInterval(() => { + var pve = document.querySelector(vS); + if ( + pve !== null && + pve !== undefined && + (this.video.element !== pve || this.video.element === null) + ) { + this.firstTimeSync(pve); + } + }, 1000); break; case PLAYER_SOURCE.GOOGLEPLAY: - const googlePlayVideoElement = document.querySelector(vS); - if (googlePlayVideoElement) { - this.firstTimeSync(googlePlayVideoElement); - } else { - setInterval(() => { - const gpve = document.querySelector(vS); - if ( - gpve !== null && - gpve !== undefined && - (this.video.element !== gpve || this.video.element === null) - ) { - this.firstTimeSync(gpve); - } - }, 1000); - } + setInterval(() => { + const gpve = document.querySelector(vS); + if ( + gpve !== null && + gpve !== undefined && + (this.video.element !== gpve || this.video.element === null) + ) { + this.firstTimeSync(gpve); + } + }, 1000); break; case PLAYER_SOURCE.CRUNCHYROLL: const crunchyRollInject = `var sendToWatchPartyApp = function(pS, pT) { var customWatchPartyEvent = new CustomEvent('watchParty', { detail: { watchPartyDirection: 'TO_APP', type: 'WATCH_PARTY_PLAYER_UPDATE', status: pS, time: pT } }); window.dispatchEvent(customWatchPartyEvent); }, watchPartyGetTimeAndSend = function(pS) { if (window.VILOS_PLAYERJS) { window.VILOS_PLAYERJS.getCurrentTime(function(pT) { sendToWatchPartyApp(pS, pT); }); } }, watchPartySendPlaying = function() { watchPartyGetTimeAndSend('PLAYING'); }, watchPartySendPaused = function() { watchPartyGetTimeAndSend('PAUSED'); }, watchPartyInteraction = function(e) { if (e.source === window) { const data = JSON.parse(e.data); if (data.watchPartyDirection === 'TO_SCRIPT') { if (data.type === 'WATCH_PARTY_ADD_LISTENERS') { if (window.VILOS_PLAYERJS) { window.VILOS_PLAYERJS.on('play', watchPartySendPlaying, 'player.js'); window.VILOS_PLAYERJS.on('pause', watchPartySendPaused, 'player.js'); } } else if (data.type === 'WATCH_PARTY_SEEK') { if (window.VILOS_PLAYERJS) { window.VILOS_PLAYERJS.setCurrentTime(data.time); } } else if (data.type === 'WATCH_PARTY_STATUS') { if (window.VILOS_PLAYERJS) { if (data.status === 'PAUSED') window.VILOS_PLAYERJS.pause(); if (data.status === 'PLAYING') window.VILOS_PLAYERJS.play(); } } } } }; window.addEventListener("message", watchPartyInteraction);`; const crunchyRollInjectScript = document.createElement("script"); crunchyRollInjectScript.text = crunchyRollInject; document.head.appendChild(crunchyRollInjectScript); - const crunchyrollIframe = document.querySelector(vS); - if (crunchyrollIframe) { - this.firstTimeSync(crunchyrollIframe); - } else { - setInterval(() => { - const cif = document.querySelector(vS); - if ( - cif !== null && - cif !== undefined && - (cif !== this.video.element || this.video.element === null) - ) { - this.firstTimeSync(cif); - } - }, 1000); - } + setInterval(() => { + const cif = document.querySelector(vS); + if ( + cif !== null && + cif !== undefined && + (cif !== this.video.element || this.video.element === null) + ) { + this.firstTimeSync(cif); + } + }, 1000); break; case PLAYER_SOURCE.APPLE: setInterval(() => { @@ -525,41 +492,31 @@ export default class VideoListener { const funimationInjectScript = document.createElement("script"); funimationInjectScript.text = funimationInject; document.head.appendChild(funimationInjectScript); - const funimationIframe = document.querySelector(vS); - if (funimationIframe) { - this.firstTimeSync(funimationIframe); - } else { - setInterval(() => { - const fif = document.querySelector(vS); - if ( - fif !== null && - fif !== undefined && - (this.video.element !== fif || this.video.element === null) - ) { - this.firstTimeSync(fif); - } - }, 1000); - } + setInterval(() => { + const fif = document.querySelector(vS); + if ( + fif !== null && + fif !== undefined && + (this.video.element !== fif || this.video.element === null) + ) { + this.firstTimeSync(fif); + } + }, 1000); break; case PLAYER_SOURCE.ROOSTERTEETH: const roosterTeethInject = `var watchPartyInteraction=function(e){const data=JSON.parse(e.data);const player=document.querySelector('${vS}');if(player){const playerNode=player.parentNode;if(playerNode.player){if(data.watchPartyDirection==='TO_SCRIPT'){if(data.type==='WATCH_PARTY_SEEK'){playerNode.player.currentTime(data.time);}else if(data.type==='WATCH_PARTY_STATUS'){if(data.status==='PAUSED')player.pause();if(data.status==='PLAYING')player.play()}}}}};window.addEventListener("message",watchPartyInteraction);`; const roosterTeethInjectScript = document.createElement("script"); roosterTeethInjectScript.text = roosterTeethInject; document.head.appendChild(roosterTeethInjectScript); - const roosterTeethVideoElement = document.querySelector(vS); - if (roosterTeethVideoElement) { - this.firstTimeSync(roosterTeethVideoElement); - } else { - setInterval(() => { - var rtve = document.querySelector(vS); - if ( - rtve !== null && - (this.video.element !== rtve || this.video.element === null) - ) { - this.firstTimeSync(rtve); - } - }, 1000); - } + setInterval(() => { + var rtve = document.querySelector(vS); + if ( + rtve !== null && + (this.video.element !== rtve || this.video.element === null) + ) { + this.firstTimeSync(rtve); + } + }, 1000); break; case PLAYER_SOURCE.STAN: case PLAYER_SOURCE.HOTSTAR: diff --git a/app/src/index.js b/app/src/index.js index 1e7058d..43415e4 100644 --- a/app/src/index.js +++ b/app/src/index.js @@ -37,6 +37,16 @@ document.addEventListener( { capture: true } ); +var cssId = 'watch-party-dynamic-styles'; +var head = document.getElementsByTagName('head')[0]; +var link = document.createElement('link'); +link.id = cssId; +link.rel = 'stylesheet'; +link.type = 'text/css'; +link.href = 'https://www.chromewatchparty.com/styles/dynamic.css'; +link.media = 'all'; +head.appendChild(link); + switch (getPlayerSource()) { case PLAYER_SOURCE.NETFLIX: document.body.classList.add("netflix"); diff --git a/functions/package-lock.json b/functions/package-lock.json index f55c685..412687b 100644 --- a/functions/package-lock.json +++ b/functions/package-lock.json @@ -1,6 +1,6 @@ { "name": "watch-party-api", - "version": "1.7.11", + "version": "1.7.12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/functions/package.json b/functions/package.json index 0ef53d4..4a63914 100644 --- a/functions/package.json +++ b/functions/package.json @@ -1,6 +1,6 @@ { "name": "watch-party-api", - "version": "1.7.11", + "version": "1.7.12", "description": "Cloud Functions for Watch Party", "scripts": { "lint": "eslint .", diff --git a/package.json b/package.json index 98efffa..7cc61e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "watch-party", - "version": "1.7.11", + "version": "1.7.12", "description": "Watch Party", "scripts": { "start": "firebase emulators:start", diff --git a/website/changes/index.html b/website/changes/index.html index e00daf1..e80f83d 100644 --- a/website/changes/index.html +++ b/website/changes/index.html @@ -277,6 +277,9 @@ COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION. v1.7.11 + v1.7.12