autoplay=1 not working for <iframe> in playing video in mobile devices [duplicate]

北城以北 提交于 2019-12-24 03:49:08

问题


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


回答1:


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>



回答2:


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



来源:https://stackoverflow.com/questions/27498032/autoplay-1-not-working-for-iframe-in-playing-video-in-mobile-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!