0

I've got this piece of code working on FF/IE, but the listener is being ignored when on an iPad. I started with the "canplay" event, but found the loadmetadata event [here][1]. Not sure how else to tell the ipad to go the start point - any suggestions?

<video id='video' controls preload='none' >
    <p>Your user agent does not support the HTML5 Video element.</p>
</video>

// For firefox and develpent
var src = 'http://media.w3.org/2010/05/video/movie_300.webm';
// For actual IPad production environment using our Wowza media server
var src = 'http://www.ourwowzaserver/videos/mp4:ourvideo.mp4/playlist.m3u8';

var start_seconds = 45;

document._video = document.getElementById("video");
document._video.setAttribute("src", src);
document._video.play();
document._video.addEventListener('loadedmetadata', function() {
        this.currentTime = start_seconds;
    }, false);


[1]: http://stackoverflow.com/questions/5981427/start-html5-video-at-a-particular-position-when-loading  
GDP
  • 8,109
  • 6
  • 45
  • 82
  • Is this code being executed after the video object has been created? – user1470118 May 09 '13 at 18:36
  • yes. Just edited question to show it – GDP May 09 '13 at 18:41
  • Well, I can tell you one problem... you're attempting to play a webm video on Safari. Safari doesn't play that type of video. See here: http://www.w3schools.com/html/html5_video.asp – user1470118 May 09 '13 at 18:46
  • @user1470118 - That's just for the question...I'm using FF/webm for tinkering/developing, then mp44/m3u8 on the ipad. Everything loads/plays in the actual code, except setting the currenttime. – GDP May 09 '13 at 19:17

1 Answers1

0

Have you tried using DOM event?

document._video.onloadedmetadata=document._video.currentTime = start_seconds;

http://www.w3schools.com/tags/av_event_loadedmetadata.asp

user1470118
  • 412
  • 2
  • 9
  • 24
  • Hmm, how about this: http://clubajax.org/ipad-bug-fix-for-dynamically-created-html5-video/. If you look at the topic "the bug/the fix" he mentions that the problem might be with it not reading/setting the video. He recommended using something getElementsByTagName("video")[0]; – user1470118 May 13 '13 at 17:48