0

这是我的代码片段:

      <video id="myVideo" style="width: 640px; height: 480px; border: solid 1px #ccc;"></video>
      <button onclick="showError()">Click Me</button>
      <script type="text/javascript">
           function showError() {
               console.log('clicked');
               var v = document.getElementById('myVideo');
               v.addEventListener('error',function(e){
                    console.log('>> error happened');
                    },true);
               v.src = 'http://127.0.0.1:9999/test.mp4';
               v.load();
               v.play();
           }
      </script>

视频源 url 不可用,因此当单击按钮时,应调度“错误”事件。它适用于 iOS 8.1 的 safari,但在 iOS 8.2 上失败。有什么解决方法可以让它工作吗?

4

0 回答 0