在iOS 8.2的Safari上无法侦听视频错误

时间:2015-03-20 06:25:38

标签: ios safari html5-video ios8.2

这是我的代码段:

      <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>

视频源网址不可用,因此当点击该按钮时,&#34;错误&#34;事件应该发送。它适用于iOS 8.1的Safari,但在iOS 8.2上失败了。是否有任何解决方法使其有效?

0 个答案:

没有答案