1 | <script> |
2 | if ( "wView" in window) { |
3 | window.wView.allowsInlineMediaPlayback = "YES" ; |
4 | window.wView.mediaPlaybackRequiresUserAction = "NO" ; |
5 | } |
6 | </script> |
在head中加入此段代码,ios音视频不能自动播放的问题迎刃而解。
当然,在video标签中,需要先设定autoplay和preload属性,如下:
1 | < video src = "camnpr.mpg" autoplay preload></ video > |