Modaal
Modaal copied to clipboard
Video auto play
Firstly, thanks for a great plugin. The simplicity is certainly welcomed and refreshing.
On to my question... is there a way to auto play videos on open of Modaal? Specifically looking for Vimeo but I guess both YouTube and Vimeo would be helpful.
hi @nathobson, thanks for raising the ticket. with the current implementation of video modals I can definitely see how this level of control may be useful. There are also a number of other options available to both Youtube and Vimeo (such as Vimeo's portrait, title and byline), so we'll look for the simplest implementation for extra options.
Just to quickly not, we've probably some higher priority issues to address before we find the time to get to this one, but I don't see if being to complicated to work in, so we'll aim to roll out a fix for this sometime in the near future.
Thanks again.
Appreciate the reply @danhumaan.
Totally understand that this probably isn't a high priority and agree that it would be a nice addition in the future.
I'll keep my eye out for an update.
If you add the parameter autoplay=1
to the end of the URI, it will autoplay. This is true for both YouTube and Vimeo.
Examples:
- https://developers.google.com/youtube/player_parameters#autoplay
<a href="https://www.youtube.com/embed/M7lc1UVf-VE?autoplay=1" class="video">YouTube</a>
- https://vimeo.com/help/faq/sharing-videos/embedding-videos#how-do-i-set-videos-to-autoplay-or-loop-when-i-embed-them
<a href="https://player.vimeo.com/video/142216434?autoplay=1" class="video">Vimeo</a>
thanks @pjconnors!
I've found that adding ?autoplay=1 alone no longer works.
Base on this SO answer, I've got it working by altering a bit in the modaal.js:
<iframe src="'+a+'" class="modaal-video-frame" frameborder="0" allowfullscreen></iframe>
to:
<iframe src="'+a+'" class="modaal-video-frame" frameborder="0" allow="autoplay; fullscreen"></iframe>
Specifically, allowfullscreen change to allow="autoplay; fullscreen"
This seems to work for YouTube, not sure about Vimeo...
@danhumaan, would it be possible to add autoplay in as an option? Thanks in advance!
I second that @chriszacker @danhumaan. That would be great!