Modaal icon indicating copy to clipboard operation
Modaal copied to clipboard

Video auto play

Open nathobson opened this issue 8 years ago • 7 comments

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.

nathobson avatar May 19 '16 16:05 nathobson

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.

danhumaan avatar May 20 '16 07:05 danhumaan

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.

nathobson avatar May 20 '16 12:05 nathobson

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>

pjconnors avatar Jun 09 '16 19:06 pjconnors

thanks @pjconnors!

danhumaan avatar Jun 10 '16 09:06 danhumaan

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...

a-henderson avatar Mar 07 '19 15:03 a-henderson

@danhumaan, would it be possible to add autoplay in as an option? Thanks in advance!

chriszacker avatar Apr 18 '19 20:04 chriszacker

I second that @chriszacker @danhumaan. That would be great!

estaples avatar May 16 '19 20:05 estaples