2

I have the code below, with a video that starts at second 483. It works fine with most browsers except for IE10, that it starts at 0:00.

<video controls preload="metadata">
<source src="http://example.com/myvideo.mp4#t=483" type="video/mp4">
</video>

3 Answers3

3

as per this question

Setting HTML5 audio position

In order to support seeking and playing back regions of the media that aren't yet downloaded, Gecko uses HTTP 1.1 byte-range requests to retrieve the media from the seek target position. In addition, if you don't serve X-Content-Duration headers, Gecko uses byte-range requests to seek to the end of the media (assuming you serve the Content-Length header) in order to determine the duration of the media.

you can use jQuery

$('video').bind('canplay', function() {
  this.currentTime = 483;
});
Community
  • 1
  • 1
Vitorino fernandes
  • 14,966
  • 2
  • 16
  • 37
0

The HTML5 video element gets you started using video elements on your webpages. With the addition of JavaScript, you can programmatically create custom playback controls, get and set the current playing position, and change the current video. You can also apply execution time.

Your HTML changes:

<video controls preload="metadata" id="Video1">
<source src="http://example.com/myvideo.mp4" type="video/mp4">
</video>

JS code:

 var video = document.getElementById("Video1"); 
 if (video.canPlayType) {   // tests that we have HTML5 video support
   video.addEventListener("canplay", function(){
                setTime(483);   //specified time
   }, false);
 }

setTime function:

function setTime(tValue) {
            //  if no video is loaded, this throws an exception 
                try {
                    if (tValue == 0) {
                        video.currentTime = tValue;
                    }
                    else {
                        video.currentTime += tValue;
                    }

                 } catch (err) {
                     // errMessage(err) // show exception
                 console.log("Video content might not be loaded");
                   }
         }

You can get more details at Using JavaScript to control the HTML5 video player

Mazzu
  • 2,676
  • 18
  • 29
0

The '#t' syntax is part of the W3C's Media Fragments URI Specification, that can be found here. According to this article, IE does not support this, although other major browsers do. So you will have to control the playback using Javascript till IE provides support for this specification.

Interestingly I was able to find an IE user's feedback to Microsoft's IE feedback portal regarding this issue. Let me share it here.