HTML5视频无法在iOS模拟器Safari中播放

时间:2015-04-09 18:22:35

标签: ios html5 ipad html5-video ios-simulator

我使用iOS模拟器在iPhone和iPad上测试网站。我有一个video标签适用于所有其他浏览器但不适用于iOS Safari(在模拟器中 - 我没有真正的iPhone / iPad)。我从这里创建了视频代码:http://camendesign.com/code/video_for_everybody#video-code

<!-- first try HTML5 playback: if serving as XML, expand `controls` to `controls="controls"` and autoplay likewise -->
<!-- warning: playback does not work on iOS3 if you include the poster attribute! fixed in iOS4.0 -->
<video width="640" height="360" controls>
    <!-- MP4 must be first for iPad! -->
    <source src="testvideo.mp4" type="video/mp4" /><!-- Safari / iOS video    -->
    <source src="testvideo.ogv" type="video/ogg" /><!-- Firefox / Opera / Chrome10 -->
    <!-- fallback to Flash: -->
    <object width="640" height="360" type="application/x-shockwave-flash" data="player.swf">
        <!-- Firefox uses the `data` attribute above, IE/Safari uses the param below -->
        <param name="movie" value="player.swf" />
        <param name="flashvars" value="controlbar=over&amp;image=myimage.jpg&amp;file=testvideo.mp4" />
        <!-- fallback image. note the title field below, put the title of the video there -->
        <img src="__VIDEO__.JPG" width="640" height="360" alt="test title"
             title="No video playback capabilities, please download the video below" />
    </object>
</video>
<!-- you *must* offer a download link as they may be able to play the file locally. customise this bit all you want -->
<p> <strong>Download Video:</strong>
    Closed Format:  <a href="testvideo.mp4">"MP4"</a>
    Open Format:    <a href="testvideo.ogv">"Ogg"</a>
</p>

可能导致此问题的原因是什么?是模拟器还是视频?还是代码?

编辑:当我点击要播放的视频图像时,它会快速打开,然后会弹出一条错误消息:&#34;操作无法完成&#34;

1 个答案:

答案 0 :(得分:0)

检查屏幕截图。视频在iOS模拟器中工作正常。请参阅网址 - http://camendesign.com/code/video_for_everybody/test.html

enter image description here