1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-02 09:11:54 +02:00

Added Support for custom video start time

1) The Start Time can be set via the data-setup array
2) If 'start-time' is not present defaut time of 0 seconds is used
3) To set a custom start time for a video simply set start-time to be
equal to the number of seconds from the start of the video you would
like to begin at.
For Example: "start-time":80 means that the video will start at
timecode 00:01:20 -> HH:MM:SS
This commit is contained in:
Joseph Afework 2013-01-26 16:33:55 -08:00
parent 8671f1ff91
commit ab5f977d62

12
src/js/controls.js vendored
View File

@ -199,8 +199,14 @@ vjs.PlayToggle.prototype.buildCSSClass = function(){
// OnClick - Toggle between play and pause
vjs.PlayToggle.prototype.onClick = function(){
if (this.player_.paused()) {
if (this.player_.currentTime() === this.player_.duration() || this.player_.currentTime() === 0 ){
if(this.options_['start-time']!== undefined){
this.player_.currentTime(this.options_['start-time']);
}
}
this.player_.play();
} else {
}
else {
this.player_.pause();
}
};
@ -272,9 +278,7 @@ vjs.BigPlayButton.prototype.createEl = function(){
vjs.BigPlayButton.prototype.onClick = function(){
// Go back to the beginning if big play button is showing at the end.
// Have to check for current time otherwise it might throw a 'not ready' error.
if(this.player_.currentTime()) {
this.player_.currentTime(0);
}
this.player_.play();
};