lazysizes icon indicating copy to clipboard operation
lazysizes copied to clipboard

Some YouTube videos not available on mobile when using Lazysizes

Open miguelzafra opened this issue 4 years ago • 7 comments

Hello,

I am using LazySizes and is working perfect on desktop. However, on mobile there are a lot of YouTube videos that I see the thumbnail of the video and when I click to play it shows "This video is not available". It only happens with YouTube videos from famous artists' channels but not with all. Looks like a permissions issue, however, If I change data-src to src on the iframes then it works perfectly but of course, lazysizes don't.

IMG_46FE31171D04-1

I tried using Chrome Mobile and Safari Mobile on the iPhone. On chrome desktop, it is working fine.

Any idea? Thank you!

miguelzafra avatar Sep 23 '19 17:09 miguelzafra

I currently have not much time, but this sounds bad. Could you share one of those non-working urls?

aFarkas avatar Sep 23 '19 19:09 aFarkas

Sure,

you can test it here (is still a work in progress page) on mobile:

https://nsuestudio.com/2020/docs/musicindustry/?name=Peter

Search: "Ana Belén" or "Ana Guerra".

Iframes examples that are not working on mobile:

Thank you for your time! MZ.

El lun., 23 sept. 2019 a las 21:51, Alexander Farkas (< [email protected]>) escribió:

I currently have not much time, but this sounds bad. Could you share one of those non-working urls?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aFarkas/lazysizes/issues/705?email_source=notifications&email_token=AEKHR2QUYZJ4UBFXPRJGZLTQLEM53A5CNFSM4IZNTVD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7MBZYA#issuecomment-534256864, or mute the thread https://github.com/notifications/unsubscribe-auth/AEKHR2TTLLROVRHV77DSW63QLEM53ANCNFSM4IZNTVDQ .

--

MIGUEL ZAFRA MANAGING DIRECTOR

*New Spanish Office: * Calle Preciados 29, 4B (Pza. Callao) 28013, Madrid, Spain +34 672 817 115 Linkedin http://www.linkedin.com/in/miguelzafra | Twitter http://twitter.com/nsuestudio | Instagram https://www.instagram.com/nsuestudio/ http://www.nsuestudio.com

miguelzafra avatar Sep 23 '19 19:09 miguelzafra

Hello Alexander,

I don't know if you had the chance to see this.

Thank you so much! MZ.

El lun., 23 sept. 2019 a las 21:56, Miguel Zafra (< [email protected]>) escribió:

Sure,

you can test it here (is still a work in progress page) on mobile:

https://nsuestudio.com/2020/docs/musicindustry/?name=Peter

Search: "Ana Belén" or "Ana Guerra".

Iframes examples that are not working on mobile:

Thank you for your time! MZ.

El lun., 23 sept. 2019 a las 21:51, Alexander Farkas (< [email protected]>) escribió:

I currently have not much time, but this sounds bad. Could you share one of those non-working urls?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aFarkas/lazysizes/issues/705?email_source=notifications&email_token=AEKHR2QUYZJ4UBFXPRJGZLTQLEM53A5CNFSM4IZNTVD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7MBZYA#issuecomment-534256864, or mute the thread https://github.com/notifications/unsubscribe-auth/AEKHR2TTLLROVRHV77DSW63QLEM53ANCNFSM4IZNTVDQ .

--

MIGUEL ZAFRA MANAGING DIRECTOR

*New Spanish Office: * Calle Preciados 29, 4B (Pza. Callao) 28013, Madrid, Spain +34 672 817 115 Linkedin http://www.linkedin.com/in/miguelzafra | Twitter http://twitter.com/nsuestudio | Instagram https://www.instagram.com/nsuestudio/ http://www.nsuestudio.com

--

MIGUEL ZAFRA MANAGING DIRECTOR

*New Spanish Office: * Calle Preciados 29, 4B (Pza. Callao) 28013, Madrid, Spain +34 672 817 115 Linkedin http://www.linkedin.com/in/miguelzafra | Twitter http://twitter.com/nsuestudio | Instagram https://www.instagram.com/nsuestudio/ http://www.nsuestudio.com

miguelzafra avatar Sep 30 '19 10:09 miguelzafra

This is also happening on my site. It works perfectly on desktop for Vimeo iframe embeds but returns a privacy error or a blank space on iPhones. Any help on this would be much appreciated!

leanne616 avatar Mar 30 '20 22:03 leanne616

I was able to resolve the issue by changing this:

Comment out code: elem.contentWindow.location.replace(src);

Replace with: elem.src = src;

Resulting code: var changeIframeSrc = function(elem, src){ try { elem.src = src; //elem.contentWindow.location.replace(src); } catch(e){ elem.src = src; } };

tan-allan avatar May 26 '20 06:05 tan-allan

@tan-allan I can not change this like this because changing the src of an `iframe´ adds a history entry to the browser (at least Firefox). If you are willing to do so you can write something like this:

// <iframe data-iframe-src="yt-src"></iframe>
window.addEventListener('lazybeforeunveil', ({target}) => {
   if(target.dataset.iframeSrc) {
       target.src = target.dataset.iframeSrc;
   }
});

aFarkas avatar Jun 01 '20 18:06 aFarkas

@aFarkas What if we remove the iframe and re-construct as mentioned here ?

sudharsan-p avatar Oct 19 '21 06:10 sudharsan-p