开发者

HTML5 video element on iPhone issue

when I use the HTML5 <video> element in the iPhone iOS Safari browser and I click on the placeholder it in order to play the video, the full-screen video player is started...

The problem is that especially when user is connected over GPRS/EDGE bearer it takes some time until the video can be started (something must be cached...).

If the user meanwhile presses the "Done" button and returns back to the page and then tries to launch the video player again nothing happens until some part of the video is cached and from user point of view it looks like the video link does not work... Is there any way how to deal with it? Listening for some event, etc.

<html>
  <head>
    <script type="text/javascript">  

      function playvideo()  
      {  
        var elem = document.getElementById("id-video");  
        elem.play();
      }  
    </script>  

  </head>

  <body>
    <video
           id="id-video"
           width="200"
           height="160"
           src="space.mp4"
    >
    </video>

    <input type="button" value开发者_运维百科="HTMLPlay" onClick="playvideo()"/>
  </body>
</html>

BR Petr


The only thing you can easily do is reduce the size of the video file. This doesn't have to effect all users, just those on slow internet connections (which you can detect this way).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜