biati-digital / glightbox

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

Is there a way to play a youtube video from a specific time? #439

Closed kouroubel closed 1 year ago

kouroubel commented 1 year ago

Is there a way to open a video from youtube at a specific time? My code now looks like this

<a href="https://youtu.be/YNNgHkPbODg?t=147" class="glightbox btn-watch-video d-flex align-items-center" data-startAt="100"><i class="bi bi-play-circle"></i><span>Στο πεδίο</span></a>

but the video starts from the beginning instead of at 147s.

gingerchew commented 1 year ago

First, you gotta format all your data-* attributes in kebabcase. Otherwise you’ll run into issues.

Second, no there is not a way. You can do it pretty easily with the events provided. There is a player variable passed for some of the events.

gingerchew commented 1 year ago

If you need help beyond that, you can make a discussion and someone may be able to help you there. Otherwise, going to close this issue.