midzer / tobii

An accessible, open-source lightbox with no dependencies
https://midzer.github.io/tobii/demo/
MIT License
196 stars 20 forks source link

Youtube API errors #70

Closed viliusle closed 3 years ago

viliusle commented 3 years ago

Sometimes if you have page with lots of resources, YouTube modal videos will throw random errors: (sometimes it works, sometimes video does not load, sometimes you get errors when you try to close video and dark overlay stays.....).

After googling, youtube devs says, it chrome issue, so there will be no fix ... And I understand that it is not your problem directly, but i want to find a way, since other users will probably get this too.

Solution can be remove YouTube API and use simple iframe, like it was on previous Tobii version (I just checked code, still have it). Or provide settings for devs to choose how youtube will be played.

1st error: https://www.youtube.com/s/player/11aba956/www-widgetapi.vflset/www-widgetapi.js

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('') does not match the recipient window's origin ('').

2nd error: lightbox.js?ver=1624634839:97

Uncaught TypeError: a[e.getAttribute(...)].playVideo is not a function at Object.onLoad (lightbox.js?ver=1624634839:97) at Y (lightbox.js?ver=1624634839:167) at q (lightbox.js?ver=1624634839:151) at HTMLAnchorElement.W (lightbox.js?ver=1624634839:201)

viliusle commented 3 years ago

I fixed using YouTube in iframe mode.