autoplay=1 not working for <iframe> in playi

2019-07-16 04:57发布

I'm working with video. When i click on Video Thumbnail a pop appears and Video plays in that,I need to start play the video (without clicking the play button) when popup opened.I tried with code below.

It was working perfect in web but not in mobile devices like iPhone ,iPad

<iframe
        title="YouTube video player"
        id="videoFrame"
        class="youtube_iframe" src="http://www.youtube.com/embed/JW5meKfy3fY?wmode=opaque&amp;autoplay=1"
        frameborder="0"   width="395" height="280"        allowfullscreen=""        scrolling="no">
</iframe>

But not auto played when video is opend in popup. thankx in advancee

3条回答
小情绪 Triste *
2楼-- · 2019-07-16 05:16

chrome Android 53 and above supports autoplay and IOS 10 + supports autoplay you need to use muted and autoplay attributes in the video tag

<video width="465" height="315" muted autoplay src="movie.mp4"></video>

chrome docs here

查看更多
Rolldiameter
3楼-- · 2019-07-16 05:18

Finally i got an answer. That

It can't be done. For various reasons (including, but not limited to data usage), Apple doesn't allow auto-playing of videos.

See the https://stackoverflow.com/a/8142187/3933697

查看更多
【Aperson】
4楼-- · 2019-07-16 05:20

To add muted in an iframe link use it like "&muted=1". The complete link will be something like:

<iframe id="video-iframe" src="https://player.vimeo.com/video/125472391?api=1&player_id=video-iframe&autoplay=1&muted=1&loop=1&color=ffffff" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" frameborder="0"></iframe>
查看更多
登录 后发表回答