From 7c61486542325aea106f16e227e3d4f088530b6c Mon Sep 17 00:00:00 2001 From: Ayushya Amitabh Date: Sat, 25 Jul 2020 22:15:03 -0400 Subject: [PATCH] v1.5.2/fullscreen support --- app/src/App.js | 8 -------- app/src/Chat.js | 32 +++++++++++++++++++++++++++++++- app/src/Create.js | 12 +++++++++++- app/src/Thread.js | 2 +- app/src/VideoListener.js | 1 + app/src/index.css | 12 ++++++++++++ app/src/index.js | 13 +++++++++++++ website/welcome/index.html | 8 ++++++++ 8 files changed, 77 insertions(+), 11 deletions(-) diff --git a/app/src/App.js b/app/src/App.js index 581be04..7dcdcc1 100644 --- a/app/src/App.js +++ b/app/src/App.js @@ -41,14 +41,6 @@ const darkTheme = createMuiTheme({ }, }); -function hboClickFix(ev) { - if (document.querySelector('body.visible')) { - ev.preventDefault(); - ev.stopPropagation(); - ev.stopImmediatePropagation(); - } -} - const Routes = (props) => ( diff --git a/app/src/Chat.js b/app/src/Chat.js index 4883eca..b7128d5 100644 --- a/app/src/Chat.js +++ b/app/src/Chat.js @@ -66,6 +66,8 @@ import { PlayCircleFilled, Cancel, Error, + FullscreenExit, + Fullscreen, } from '@material-ui/icons'; import Create from './Create'; import { goTo } from 'route-lite'; @@ -101,6 +103,7 @@ export default class Chat extends Component { menuPopover: true, allowChatNotification: LocalData().allowChatNotification !== undefined ? LocalData().allowChatNotification : true, + isFullscreen: document.fullscreen, }; this.port = null; this.gifClick = this.gifClick.bind(this); @@ -133,6 +136,17 @@ export default class Chat extends Component { } }; + // FULLSCREEN LISTENER + document.addEventListener('fullscreenchange', (ev) => { + this.setState({ isFullscreen: document.fullscreen }); + }); + + // ACTIVE TRACKER + updateLocalData({ lastActive: new Date().getTime() }); + setInterval(() => { + updateLocalData({ lastActive: new Date().getTime() }); + }, 60000); + // VIDEO LISTENER START this.mVideoListener.start(); @@ -262,6 +276,9 @@ export default class Chat extends Component { time: new Date(), type: '', }; + const { messages } = this.state; + messages.push({ ...data, type: 'pending' }); + this.setState({ messages }); if (this.state.gif === true) data.type = 'giphy'; SendMessageApi(data).catch((err) => { this.props.notify(err.message || err.statusText); @@ -301,6 +318,13 @@ export default class Chat extends Component { updateLocalData({ allowChatNotification: !this.state.allowChatNotification }); this.setState({ allowChatNotification: !this.state.allowChatNotification }); } + toggleFullscreen() { + if (document.fullscreen) { + document.exitFullscreen(); + } else { + document.documentElement.requestFullscreen(); + } + } render() { const { admin, @@ -315,6 +339,7 @@ export default class Chat extends Component { users, callActionPending, usersOnCall, + isFullscreen, } = this.state; return (
@@ -490,12 +515,17 @@ export default class Chat extends Component { ); - } + } else return null; })}
+ {gif || newMessage ? null : ( + + {isFullscreen ? : } + + )} {gif || newMessage ? null : ( res.json()) .then((joinResult) => { diff --git a/app/src/Thread.js b/app/src/Thread.js index 948c17d..36c835f 100644 --- a/app/src/Thread.js +++ b/app/src/Thread.js @@ -19,7 +19,7 @@ HBO Now and HBO Max logos are trademark and intellectual property of WarnerMedia import React from 'react'; import { Typography } from '@material-ui/core'; import './Thread.css'; -import { LocalData, getUserUid } from './Api'; +import { LocalData } from './Api'; const Thread = (props) => props.messages.map((m, midx) => { diff --git a/app/src/VideoListener.js b/app/src/VideoListener.js index bb304eb..eadc593 100644 --- a/app/src/VideoListener.js +++ b/app/src/VideoListener.js @@ -113,6 +113,7 @@ export default class VideoListener { simulate(sliderHead, 'mousedown'); simulate(sliderHead, 'mouseup'); await this.timeout(500); + break; default: break; } diff --git a/app/src/index.css b/app/src/index.css index 3f82cc9..72d8d58 100644 --- a/app/src/index.css +++ b/app/src/index.css @@ -126,6 +126,18 @@ body.peacock.visible .playback-header__container { position: relative; max-width: 100%; } + +/* +FULL SCREEN BUTTON REMOVER +*/ +body.netflix + .touchable.PlayerControls--control-element.nfp-button-control.default-control-button.button-nfplayerFullscreen, +body.hulu .controls__view-mode-button-normal-icon.player-svgicon, +body.disney .control-icon-btn.fullscreen-icon, +body.amazon .fyysciv.f1lobqlo.fk0j80b { + display: none; +} + #party-loading { position: absolute; width: 100%; diff --git a/app/src/index.js b/app/src/index.js index a7c8e6b..81f6785 100644 --- a/app/src/index.js +++ b/app/src/index.js @@ -40,6 +40,19 @@ const PartyWrapper = document.createElement('div'); PartyWrapper.id = 'party_wrapper'; document.body.appendChild(PartyWrapper); +document.addEventListener( + 'keydown', + (ev) => { + if (ev.code === 'KeyF') { + if (ev.target.tagName !== 'INPUT' && ev.target.tagName !== 'TEXTAREA') { + ev.stopImmediatePropagation(); + ev.stopPropagation(); + } + } + }, + { capture: true } +); + switch (getPlayerSource()) { case PLAYER_SOURCE.NETFLIX: document.body.classList.add('netflix'); diff --git a/website/welcome/index.html b/website/welcome/index.html index 3905a3c..a3012cb 100644 --- a/website/welcome/index.html +++ b/website/welcome/index.html @@ -70,6 +70,14 @@ Peacock TV logo is a trademark and intellectual property of Peacock TV & NBC Uni

TIPS & FAQ

+
+
+ CAN I USE WATCH PARTY IN FULLSCREEN +
+

+ To have access to Watch Party in fullscreen use the fullscreen button in the bottom left corner of the sidebar. +

+
CAN I USE THE SAME PARTY, ON A DIFFERENT SITE