1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-24 08:42:25 +02:00

Add played property for player

This commit is contained in:
brainopia 2014-05-29 13:52:55 +04:00
parent d09cec80a0
commit 6d8bf982c2
3 changed files with 22 additions and 2 deletions

View File

@ -313,6 +313,10 @@ vjs.Flash.prototype.buffered = function(){
return vjs.createTimeRange(0, this.el_.vjs_getProperty('buffered'));
};
vjs.Flash.prototype.played = function(){
return vjs.createTimeRange(0, this.el_.vjs_getProperty('currentTime'));
};
vjs.Flash.prototype.supportsFullScreen = function(){
return false; // Flash does not allow fullscreen through javascript
};

View File

@ -180,6 +180,7 @@ vjs.Html5.prototype.setCurrentTime = function(seconds){
vjs.Html5.prototype.duration = function(){ return this.el_.duration || 0; };
vjs.Html5.prototype.buffered = function(){ return this.el_.buffered; };
vjs.Html5.prototype.played = function(){ return this.el_.played; };
vjs.Html5.prototype.volume = function(){ return this.el_.volume; };
vjs.Html5.prototype.setVolume = function(percentAsDecimal){ this.el_.volume = percentAsDecimal; };

View File

@ -743,7 +743,7 @@ vjs.Player.prototype.remainingTime = function(){
return this.duration() - this.currentTime();
};
// http://dev.w3.org/html5/spec/video.html#dom-media-buffered
// http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#dom-media-buffered
// Buffered returns a timerange object.
// Kind of like an array of portions of the video that have been downloaded.
@ -777,6 +777,22 @@ vjs.Player.prototype.buffered = function(){
return buffered;
};
/**
* Get a TimeRange object with the times of the video that have been played.
* http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#dom-media-played
*
* @return {Object} A mock TimeRange object (following HTML spec)
*/
vjs.Player.prototype.played = function(){
var played = this.techGet('played');
if (!played || !played.length) {
played = vjs.createTimeRange(0,this.cache_.currentTime);
}
return played;
};
/**
* Get the percent (as a decimal) of the video that's been downloaded
*
@ -1531,7 +1547,6 @@ vjs.Player.prototype.playbackRate = function(rate) {
// readyState: function(){ return this.techCall('readyState'); },
// initialTime: function(){ return this.techCall('initialTime'); },
// startOffsetTime: function(){ return this.techCall('startOffsetTime'); },
// played: function(){ return this.techCall('played'); },
// seekable: function(){ return this.techCall('seekable'); },
// videoTracks: function(){ return this.techCall('videoTracks'); },
// audioTracks: function(){ return this.techCall('audioTracks'); },