Autoplay video in PhoneGap

﹥>﹥吖頭↗ 提交于 2019-12-02 07:15:58

Solved it. Turned out to be a bug in PhoneGap 1.3 which was fixed in version 1.4 released yesterday(!).

From the release notes:

Fixed CB-42 – MediaPlaybackRequiresUserAction can now be set to NO

AutoPlay attribute work in ios :

  <video src="test.m4v" autoplay="autoplay"></video>

Given this line autoplay function

"autoplay" attribute will not work in iOS so you need to use JavaScript to get it to play.

Here is some sample code:

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