Closed semenov-anton-a closed 2 years ago
@semenov-anton-a hey man sorry for an extremely late reply... I hope you solved the issue by yourself, but I'll respond just for the sake of documentation.
It is possible what you are asking for, of course, but keep in mind that this script is only for the backgrounds.
I would suggest that you just add youtube embeds to the slides of your lightbox, and to tune to the events https://github.com/biati-digital/glightbox#events.
On each slide you would check if it contains the youtube iframe, and if it does you would play it via the youtube iframe api. When the slide changes to another slide you would stop all other youtube iframes.
To achieve the same effect with this script, you would need to use the new VideoBackground('[data-youtube]')
to initialize the videos once the lightbox initializes. This constructor will return an object where you can access all the videos in the object's index
property and you can do a .play()
or .pause()
depending on which video is shown in a slide. You can get the video by it's unique index - from the index object, which is also an ID of the iframe wrapper.
See you around buddy!
Exemple. glightbox https://github.com/biati-digital/glightbox
glightbox not open video then "jquery.youtube-background" plugin work. How can stop or pause jquery.youtube-background?