biati-digital / glightbox

Pure Javascript lightbox with mobile support. It can handle images, videos with autoplay, inline content and iframes
MIT License
2.03k stars 228 forks source link

Conflict with Vimeo script. TypeError: e.embed.setMuted is not a function #420

Closed Lefthandmedia closed 1 year ago

Lefthandmedia commented 1 year ago

Hi,

When i open a slide with a video i see this error in my console, plyr.js:1 Uncaught TypeError: e.embed.setMuted is not a function at HTMLDivElement.set (plyr.js:1:73845) at set muted [as muted] (plyr.js:1:109553) at st.build (plyr.js:1:56719) at plyr.js:1:76127 I tracked the problem down to what seems to be a conflict with a a script that loads from vimeo. I come to this conclusion because the error does not show up when i let Ghostery block the 'trackers' coming from Vimeo (extend.vimeocdn.com, vimeo.com, i.vimeocdn.com, player.vimeo.com, f.vimeocdn.com)

This problem is nowhere mentioned on the site from PLYR. so i guess it has something to do with the way Plyr is implemented in Glightbox.

anyone else seeing this error?

RDG

Lefthandmedia commented 1 year ago

The conflicting script seems to be https://extend.vimeocdn.com/ga/101551308.js

Lefthandmedia commented 1 year ago

So it turns out Plyr crashes when the GoogleAnalytics script provided by Vimeo is present. Vimeo states that the provided function ( window.__vimeoRefresh() ) needs to run AFTER the video is embeded (see: https://help.vimeo.com/hc/en-us/articles/12426206785553-Integrate-the-Vimeo-player-with-Google-Analytics-and-Google-Tag-Manager ). I'm not sure if this is something Glightbox need to do when the instance of Plyr is created in the video slide or that Plyr needs to do that. Anyways right now it is impossible to get video slides containing a Vimeo video to work when the GA script from vimeo is present. RDG

biati-digital commented 1 year ago

Hi, thank's for letting me know. There's nothing GLightbox can do, everything related to the player most be posted in the Plyr repository.