通过下面的方式可以解决,在iPhone手机微信中正常自动播放。

必须在微信Weixin JSAPI的WeixinJSBridgeReady才能生效,猜测微信接口做了处理~

<audio preload="preload" controls  loop></audio> 
<video > 
      <source > 
      <source > 
      <source > 
      <p>Your user agent does not support the HTML5 Video element.</p> 
</video> 
<!-- 必须加在微信api资源 --> 
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> 
<script> 
     //一般情况下,这样就可以自动播放了,但是一些奇葩iPhone机不可以 
     document.getElementById('car_audio').play(); 
    //必须在微信Weixin JSAPI的WeixinJSBridgeReady才能生效 
    document.addEventListener("WeixinJSBridgeReady", function () { 
        document.getElementById('car_audio').play(); 
        document.getElementById('video').play(); 
    }, false); 
</script> 

相关文章:

  • 2021-12-12
  • 2021-12-19
  • 2021-12-24
  • 2021-12-03
  • 2022-01-05
  • 2021-11-09
  • 2021-09-02
  • 2022-01-17
猜你喜欢
  • 2022-12-23
  • 2021-08-28
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-12-14
  • 2021-10-23
相关资源
相似解决方案