From 9065b44a72ed649b7e12a95d84dc6fd8d651b7c3 Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 10 Sep 2021 17:36:23 +0200 Subject: [PATCH 1/2] snipe changes for ios --- .../internal/plugins/videojs-mobile-ui/plugin.js | 4 ++-- ui/component/viewers/videoViewer/view.jsx | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ui/component/viewers/videoViewer/internal/plugins/videojs-mobile-ui/plugin.js b/ui/component/viewers/videoViewer/internal/plugins/videojs-mobile-ui/plugin.js index 8bb9e0d23..9fa1ed760 100644 --- a/ui/component/viewers/videoViewer/internal/plugins/videojs-mobile-ui/plugin.js +++ b/ui/component/viewers/videoViewer/internal/plugins/videojs-mobile-ui/plugin.js @@ -151,8 +151,8 @@ const onPlayerReady = (player, options) => { * Never shows if the endscreen plugin is present */ const mobileUi = function(options) { - // if (videojs.browser.IS_ANDROID || videojs.browser.IS_IOS) { - if (videojs.browser.IS_ANDROID) { + // target both iOS and Android + if (videojs.browser.IS_ANDROID || videojs.browser.IS_IOS) { this.ready(() => { onPlayerReady(this, videojs.mergeOptions(defaults, options)); }); diff --git a/ui/component/viewers/videoViewer/view.jsx b/ui/component/viewers/videoViewer/view.jsx index 905187ded..6f2226c80 100644 --- a/ui/component/viewers/videoViewer/view.jsx +++ b/ui/component/viewers/videoViewer/view.jsx @@ -110,6 +110,12 @@ function VideoViewer(props: Props) { previousListUri, videoTheaterMode, } = props; + + const IS_IOS = + (/iPad|iPhone|iPod/.test(navigator.platform) || + (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && + !window.MSStream; + const permanentUrl = claim && claim.permanent_url; const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : []; const claimId = claim && claim.claim_id; @@ -335,6 +341,13 @@ function VideoViewer(props: Props) { // player.muted(true); // another version had player.play() } + } else { + const isPaused = player.paused(); + if (IS_IOS && isPaused) { + document.getElementsByClassName('video-js--tap-to-unmute')[0].style.visibility = 'visible'; + player.muted(true); + const iosResponse = player.play(); + } } setIsLoading(false); setIsPlaying(false); -- 2.45.2 From 9ec7b5fbfd5003609d3b50c996ee37476aac46ad Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 10 Sep 2021 19:01:46 +0200 Subject: [PATCH 2/2] seems to be working --- .../viewers/videoViewer/internal/videojs.jsx | 8 ++++---- ui/component/viewers/videoViewer/view.jsx | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index bac5fb9ba..893ca3619 100644 --- a/ui/component/viewers/videoViewer/internal/videojs.jsx +++ b/ui/component/viewers/videoViewer/internal/videojs.jsx @@ -283,10 +283,10 @@ export default React.memo(function VideoJs(props: Props) { // as the listener to update static texts. const setLabel = (controlBar, childName, label) => { - const c = controlBar.getChild(childName); - if (c) { - c.controlText(label); - } + // const c = controlBar.getChild(childName); + // if (c) { + // c.controlText(label); + // } }; const player = playerRef.current; diff --git a/ui/component/viewers/videoViewer/view.jsx b/ui/component/viewers/videoViewer/view.jsx index 6f2226c80..189ef0ab4 100644 --- a/ui/component/viewers/videoViewer/view.jsx +++ b/ui/component/viewers/videoViewer/view.jsx @@ -341,13 +341,31 @@ function VideoViewer(props: Props) { // player.muted(true); // another version had player.play() } + console.log('running here!') } else { + console.log('running here123') const isPaused = player.paused(); + + console.log('is paused'); + console.log(isPaused) if (IS_IOS && isPaused) { document.getElementsByClassName('video-js--tap-to-unmute')[0].style.visibility = 'visible'; player.muted(true); const iosResponse = player.play(); + console.log(iosResponse) } + setTimeout(function(){ + console.log('running here124') + const isPaused = player.paused(); + console.log('is paused'); + console.log(isPaused) + if (IS_IOS && isPaused) { + document.getElementsByClassName('video-js--tap-to-unmute')[0].style.visibility = 'visible'; + player.muted(true); + const iosResponse = player.play(); + console.log(iosResponse) + } + }, 1000) } setIsLoading(false); setIsPlaying(false); -- 2.45.2