Question

I'm embedding a video into a page via the iframe tag but am looking for a way to turn off the autoplay feature. Here's what I've tried so far:

Mark-Up

%iframe{:controller => "0", :height => 390, :width => 480, :frameborder => "0", :src => "//cassininazir.com/embed/he-man.mp4", :autoplay => "false"}

I also tried adding a param:

%param{:autoplay => "false"}

Since I've used the iframe tag instead of the embed tag, I'm thinking maybe this is why the autoplay="false" argument won't work. Any ideas or suggestions?

Était-ce utile?

La solution

The source video that the iframe references uses a video tag.

The cause is that pesky "autoplay" attribute in the source video tag.

It would be easiest to copy the video html from the source and add it to your Haml like this (without the autoplay attribute):

%video{ controls: "", name: "media"}
  %source{src: "http://cassininazir.com/embed/he-man.mp4", type: "video/mp4"}

Although you may be able to remove the "autoplay" attribute with jquery after the element is loaded, I think the above approach is easiest.

Here's a link to a working example.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top