v1.7.10/version change, add google drive support

This commit is contained in:
2021-03-01 01:36:56 -05:00
parent 470e335d91
commit 8877507abd
10 changed files with 54 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "watch-party-crx",
"version": "1.7.9",
"version": "1.7.10",
"private": true,
"dependencies": {},
"scripts": {
+1 -1
View File
@@ -26,7 +26,7 @@ try {
console.info("CHROME ENV");
}
const APP_VERSION = "1.7.9";
const APP_VERSION = "1.7.10";
const APP_VERSION_STRING = APP_VERSION.replace(/\./g, "");
const firebaseConfig = {
+4 -2
View File
@@ -1,7 +1,7 @@
{
"name": "Watch Party",
"short_name": "WP",
"version": "1.7.9",
"version": "1.7.10",
"description": "Watch streamed content together.",
"background": {
"page": "background.html"
@@ -47,6 +47,7 @@
"https://*.airtelxstream.in/*",
"https://*.vimeo.com/*",
"https://*.dailymotion.com/*",
"https://drive.google.com/*",
"https://api.giphy.com/*",
"https://*.voxeet.com/*"
],
@@ -89,7 +90,8 @@
"https://*.hotstar.com/*",
"https://*.airtelxstream.in/*",
"https://*.vimeo.com/*",
"https://*.dailymotion.com/*"
"https://*.dailymotion.com/*",
"https://drive.google.com/*"
],
"run_at": "document_idle",
"js": ["/static/js/content.js"],
+3
View File
@@ -43,6 +43,7 @@ export const PLAYER_SOURCE = {
AIRTEL: "airtelxstream.",
VIMEO: "vimeo.",
DAILYMOTION: "dailymotion.",
GOOGLEDRIVE: "drive.google.",
LOCAL: "localhost",
};
@@ -71,6 +72,8 @@ export const getPlayerSource = () => {
if (HREF.includes(PLAYER_SOURCE.VIMEO)) return PLAYER_SOURCE.VIMEO;
if (HREF.includes(PLAYER_SOURCE.DAILYMOTION))
return PLAYER_SOURCE.DAILYMOTION;
if (HREF.includes(PLAYER_SOURCE.GOOGLEDRIVE))
return PLAYER_SOURCE.GOOGLEDRIVE;
if (HREF.includes(PLAYER_SOURCE.LOCAL)) return PLAYER_SOURCE.LOCAL;
};
+1 -1
View File
@@ -34,7 +34,7 @@ import {
} from "./Api";
import Tutorial from "./Tutorial";
const APP_VERSION = "1.7.9";
const APP_VERSION = "1.7.10";
const APP_VERSION_STRING = APP_VERSION.replace(/\./g, "");
const darkTheme = createMuiTheme({
+35 -1
View File
@@ -143,6 +143,7 @@ export default class VideoListener {
case PLAYER_SOURCE.CRUNCHYROLL:
case PLAYER_SOURCE.FUNIMATION:
case PLAYER_SOURCE.ROOSTERTEETH:
case PLAYER_SOURCE.GOOGLEDRIVE:
window.postMessage(
JSON.stringify({
watchPartyDirection: "TO_SCRIPT",
@@ -175,7 +176,8 @@ export default class VideoListener {
PLAYER_SOURCE.HULU === this.video.source ||
PLAYER_SOURCE.NETFLIX === this.video.source ||
PLAYER_SOURCE.HBOMAX === this.video.source ||
PLAYER_SOURCE.HBONOW === this.video.source
PLAYER_SOURCE.HBONOW === this.video.source ||
PLAYER_SOURCE.GOOGLEDRIVE === this.video.source
) {
if (
serverPlayer.status === PLAYER_STATUS.PAUSED ||
@@ -500,6 +502,38 @@ export default class VideoListener {
);
}
break;
case PLAYER_SOURCE.GOOGLEDRIVE:
const googleDriveInject = `var watchPartyInteraction=function(e){const data=JSON.parse(e.data);const player=document.querySelector("${vS}").contentWindow.document.querySelector('video');if(player){if(data.watchPartyDirection==='TO_SCRIPT'){if(data.type==='WATCH_PARTY_SEEK'){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 googleDriveInjectScript = document.createElement("script");
googleDriveInjectScript.text = googleDriveInject;
document.head.appendChild(googleDriveInjectScript);
const googleDrivePlayerIframe = document.querySelector(vS);
if (googleDrivePlayerIframe) {
const googleDrivePlayer = googleDrivePlayerIframe.contentWindow.document.querySelector(
"video"
);
if (googleDrivePlayer) {
this.firstTimeSync(googleDrivePlayerIframe);
}
} else {
setInterval(
this.video.element
? null
: () => {
const gdif = document.querySelector(vS);
if (gdif) {
const gdp = gdif.contentWindow.document.querySelector(
"video"
);
if (gdp) {
this.firstTimeSync(gdif);
}
}
},
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");