开发者

html5 video not playing in ipad simulator?

开发者 https://www.devze.com 2023-01-07 04:43 出处:网络
I created xcode universal project, I am trying to load HTML5 page in UIWebViewthe problem is i cant see any control to play movie, and i am getting blank screen on the video

I created xcode universal project, I am trying to load HTML5 page in UIWebView the

problem is i cant see any control to play movie, and i am getting blank screen on the video

place, in ipad and iphone simulator,

my .html file

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
    "http://www.w3.org/TR/html4/strict.开发者_如何转开发dtd">
<html>
  <head>
    <!-- Change this if you want to allow scaling -->
    <meta name="viewport" 
        content="width=default-width; user-scalable=no" />
 
    <meta http-equiv="Content-type" 
        content="text/html; charset=utf-8">
 
    <title>Web App Demo</title>
 
  </head>
  <body>
    <h1>Video Test</h1>
    <p>This is a video test.</p>
    <video width="320" height="240" controls= "controls">
        <source src="video.ogv" type="video/ogg" />
        <source src="video.mp4" type="video/mp4"/>
             browser not supports the video
    </video>
    </br> <br/>
    <h1>This is Audio </h1>
    <b>Testing Audio </b>
    <audio controls="controls">
        <source src="audio.ogg" type="audio/ogg" />
        <source src="audio.mp3" type="audio/mpeg"/>
        browser not supporting audio
    </audio>

  </body>
</html>

Any help why its not playing in simulator.

Thanks in advance.


I have seen this before when there are url issues -- like capitalization... The simulator is more relaxed than the device... Check the exact file names...


Sounds like it might be a pathing issue. You are using relative pathnames for the video, so they need to be in the place the HTML expects them to be in order to find them. You'll need to either use absolute pathnames to the files in your bundle OR make sure that the base href is defined to point to the appropriate folder holding those images, either explicitly in the HTML or by specifying the correct baseref in the loadHTMLString:baseURL: call.

One way to quickly test whether this is a problem would be to put a .png next to the video files and reference it in the HTML, too. If the .png doesn't show up, it's not a video problem so much as a problem finding assets.


i read that the mp4 file should be placed before the ogv file for the iPad to play it.


I am playing an m4v file in my uiwebview, but the translucent 'play' button does not appear in my simulator. It does work on the device itself, though....

        <video id="VideoDiv" preload src="http://www.movietime.com/movie.m4v" controls width="480px" height="270" poster="poster.png"></video>
0

精彩评论

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