views:

457

answers:

4

Hi

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"&gt;
<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.

A: 

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.

cc
No path issues, i can play the window in iphone simulator but not in ipad simulator, in ipad simulator i cant see any control like play button but i can see black window according to my video frame size,but in iphone simulator i can see, -Thanks CC
mac
Mmm. Are you sure you're adding the video file to the iPad version? Maybe the video isn't being included in your bundle in the iPad version, but is being included in the bundle for the iPhone version. Check your targets to make sure the video file is included.Other things to check: try a different video file or different video codecs, check for case issues with the filenames, try playing the video directly instead of embedded in an HTML page, and try cleaning your target and recompiling.
cc
A: 

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

Jay Van Vark
A: 

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

Gem
A: 

I have the same issue, I have a video that plays fine in the iPhone simulator but I only see the poster frame in the iPad simulator. Clicking on the video does nothing. Any ideas what could be wrong?

Richard