From 624c9ee94f463ae09dd28b5eac1963b1618457ff Mon Sep 17 00:00:00 2001 From: Khush Jammu Date: Mon, 1 Jun 2020 12:31:07 +0800 Subject: [PATCH] rudimentary fix for picture-in-picture: just use the last-joined connection --- public/js/chat.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/js/chat.js b/public/js/chat.js index 145d310..8634978 100644 --- a/public/js/chat.js +++ b/public/js/chat.js @@ -914,21 +914,21 @@ function toggleChat() { function togglePictureInPicture() { if ( "pictureInPictureEnabled" in document || - remoteVideoVanilla.webkitSetPresentationMode + VideoChat.remoteVideoWrapper.lastChild.webkitSetPresentationMode ) { if (document.pictureInPictureElement) { document.exitPictureInPicture().catch((error) => { logIt("Error exiting pip."); logIt(error); }); - } else if (remoteVideoVanilla.webkitPresentationMode === "inline") { - remoteVideoVanilla.webkitSetPresentationMode("picture-in-picture"); + } else if (VideoChat.remoteVideoWrapper.lastChild.webkitPresentationMode === "inline") { + VideoChat.remoteVideoWrapper.lastChild.webkitSetPresentationMode("picture-in-picture"); } else if ( - remoteVideoVanilla.webkitPresentationMode === "picture-in-picture" + VideoChat.remoteVideoWrapper.lastChild.webkitPresentationMode === "picture-in-picture" ) { - remoteVideoVanilla.webkitSetPresentationMode("inline"); + VideoChat.remoteVideoWrapper.lastChild.webkitSetPresentationMode("inline"); } else { - remoteVideoVanilla.requestPictureInPicture().catch((error) => { + VideoChat.remoteVideoWrapper.lastChild.requestPictureInPicture().catch((error) => { alert( "You must be connected to another person to enter picture in picture." );