Compare commits

...

2 commits

Author SHA1 Message Date
Anthony
9ec7b5fbfd
seems to be working 2021-09-10 19:01:46 +02:00
Anthony
9065b44a72
snipe changes for ios 2021-09-10 17:36:23 +02:00
3 changed files with 37 additions and 6 deletions

View file

@ -151,8 +151,8 @@ const onPlayerReady = (player, options) => {
* Never shows if the endscreen plugin is present * Never shows if the endscreen plugin is present
*/ */
const mobileUi = function(options) { const mobileUi = function(options) {
// if (videojs.browser.IS_ANDROID || videojs.browser.IS_IOS) { // target both iOS and Android
if (videojs.browser.IS_ANDROID) { if (videojs.browser.IS_ANDROID || videojs.browser.IS_IOS) {
this.ready(() => { this.ready(() => {
onPlayerReady(this, videojs.mergeOptions(defaults, options)); onPlayerReady(this, videojs.mergeOptions(defaults, options));
}); });

View file

@ -283,10 +283,10 @@ export default React.memo<Props>(function VideoJs(props: Props) {
// as the listener to update static texts. // as the listener to update static texts.
const setLabel = (controlBar, childName, label) => { const setLabel = (controlBar, childName, label) => {
const c = controlBar.getChild(childName); // const c = controlBar.getChild(childName);
if (c) { // if (c) {
c.controlText(label); // c.controlText(label);
} // }
}; };
const player = playerRef.current; const player = playerRef.current;

View file

@ -110,6 +110,12 @@ function VideoViewer(props: Props) {
previousListUri, previousListUri,
videoTheaterMode, videoTheaterMode,
} = props; } = 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 permanentUrl = claim && claim.permanent_url;
const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : []; const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : [];
const claimId = claim && claim.claim_id; const claimId = claim && claim.claim_id;
@ -335,6 +341,31 @@ function VideoViewer(props: Props) {
// player.muted(true); // player.muted(true);
// another version had player.play() // 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); setIsLoading(false);
setIsPlaying(false); setIsPlaying(false);