diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index 5caa9aa34..0f6a168b0 100644 --- a/ui/component/viewers/videoViewer/internal/videojs.jsx +++ b/ui/component/viewers/videoViewer/internal/videojs.jsx @@ -275,6 +275,7 @@ export default React.memo(function VideoJs(props: Props) { player.volume(1.0); } } + // hide "Tap to unmute" button showTapButton(TAP.NONE); } @@ -552,18 +553,22 @@ export default React.memo(function VideoJs(props: Props) { const vjs = videojs(el, videoJsOptions, () => { - const isNotAndroidOrIos = !videojs.browser.IS_ANDROID && !videojs.browser.is_IOS; + const player = playerRef.current; - if(isNotAndroidOrIos){ + const isNotAndroidOrIos = !videojs.browser.IS_ANDROID && !videojs.browser.IS_IOS; + + if (isNotAndroidOrIos) { el.classList.add('vjs-big-play-centered'); const playBT = document.getElementsByClassName('vjs-big-play-button')[0]; playBT.style.display = 'none'; + } else { + // console.log('hiding button'); + // player.bigPlayButton.hide() + // const playBT = document.getElementsByClassName('vjs-big-play-button')[0]; + // playBT.remove() } - const player = playerRef.current; - - // this seems like a weird thing to have to check for here if (!player) return; @@ -578,46 +583,6 @@ export default React.memo(function VideoJs(props: Props) { player.on('error', onError); player.on('ended', onEnded); - // player.on('loadstart', function(){ - // console.log('LOADED HERE'); - // - // const playBT = document.getElementsByClassName('vjs-big-play-button')[0]; - // const videoDiv = player.children_[0]; - // const controlBar = document.getElementsByClassName('vjs-control-bar')[0]; - // const leftWidth = ((videoDiv.offsetWidth - playBT.offsetWidth) / 2) + 'px'; - // const availableHeight = videoDiv.offsetHeight - controlBar.offsetHeight; - // const topHeight = (((availableHeight - playBT.offsetHeight) / 2) + 11) + 'px'; - // - // playBT.style.top = topHeight; - // playBT.style.left = leftWidth; - // playBT.style.margin = 0; - // }) - - // on ios, show a play button when paused - // if (IS_IOS) { - // const playBT = document.getElementsByClassName('vjs-big-play-button')[0]; - // - // player.on('pause', function() { - // playBT.style.removeProperty('display'); - // - // const videoDiv = player.children_[0]; - // const controlBar = document.getElementsByClassName('vjs-control-bar')[0]; - // const leftWidth = ((videoDiv.offsetWidth - playBT.offsetWidth) / 2) + 'px'; - // const availableHeight = videoDiv.offsetHeight - controlBar.offsetHeight; - // const topHeight = (((availableHeight - playBT.offsetHeight) / 2) + 11) + 'px'; - // - // playBT.style.top = topHeight; - // playBT.style.left = leftWidth; - // playBT.style.margin = 0; - // }); - // - // player.on('ended', function() { - // if (showAutoplayCountdown) { - // playBT.style.display = 'none'; - // } - // }); - // } - // Replace volume bar with custom LBRY volume bar LbryVolumeBarClass.replaceExisting(player); diff --git a/ui/scss/component/_videojs.scss b/ui/scss/component/_videojs.scss index 38b9b9d39..7ca0d9862 100644 --- a/ui/scss/component/_videojs.scss +++ b/ui/scss/component/_videojs.scss @@ -150,3 +150,10 @@ .bottom-gradient { background-image: linear-gradient(to top, rgba(0, 0, 0, 0.4) 0%, transparent 72px); } + +.vjs-big-play-button { + // if the user is using a mouse + @media (pointer: none), (pointer:coarse) { + display: none !important; + } +}