1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-19 10:54:16 +02:00

Fixed Start Time Offset

Implementation has been modified to utilize the firstplay event to set
the custom start time offset of the video.

If in the data-setup array an attribute of "starttime" is specified,
then the video will start playback from the passed index in seconds.

Note: Video will only start from this index on first play only.
This commit is contained in:
Joseph Afework 2013-02-07 15:24:49 -08:00
parent bce339c405
commit 3353b75327

View File

@ -53,6 +53,15 @@ vjs.Player = function(tag, options, ready){
this.on('durationchange', this.onDurationChange);
this.on('error', this.onError);
//If the first starttime attribute is specified
//then we will start at the given offset in seconds
this.on('firstplay',function(){
if(this.options_['starttime']){
this.currentTime(this.options_['starttime']);
}
});
// Make player easily findable by ID
vjs.players[this.id_] = this;
};