1
0
mirror of https://github.com/videojs/video.js.git synced 2025-03-17 21:18:27 +02:00

Allow overriding flash methods that were previously hidden by creating them in init

This commit is contained in:
Steve Heffernan 2014-07-14 15:46:17 -07:00
parent 3352346a74
commit 02949f5b91
2 changed files with 16 additions and 17 deletions

View File

@ -60,9 +60,7 @@ vjs.Flash = vjs.MediaTechController.extend({
'id': objId,
'name': objId, // Both ID and Name needed or swf to identifty itself
'class': 'vjs-tech'
}, options['attributes']),
lastSeekTarget
}, options['attributes'])
;
// If source was supplied pass as a flash var.
@ -77,19 +75,6 @@ vjs.Flash = vjs.MediaTechController.extend({
}
}
this['setCurrentTime'] = function(time){
lastSeekTarget = time;
this.el_.vjs_setProperty('currentTime', time);
};
this['currentTime'] = function(time){
// when seeking make the reported time keep up with the requested time
// by reading the time we're seeking to
if (this.seeking()) {
return lastSeekTarget;
}
return this.el_.vjs_getProperty('currentTime');
};
// Add placeholder to player div
vjs.insertFirst(placeHolder, parentEl);
@ -284,6 +269,20 @@ vjs.Flash.prototype.src = function(src){
}
};
vjs.Flash.prototype.setCurrentTime = function(time){
this.lastSeekTarget_ = time;
this.el_.vjs_setProperty('currentTime', time);
};
vjs.Flash.prototype.currentTime = function(time){
// when seeking make the reported time keep up with the requested time
// by reading the time we're seeking to
if (this.seeking()) {
return this.lastSeekTarget_ || 0;
}
return this.el_.vjs_getProperty('currentTime');
};
vjs.Flash.prototype.currentSrc = function(){
var src = this.el_.vjs_getProperty('currentSrc');
// no src, check and see if RTMP

View File

@ -92,7 +92,7 @@ test('currentTime is the seek target during seeking', function() {
currentTime = 3;
strictEqual(3, tech.currentTime(), 'currentTime is retreived from the SWF');
tech['setCurrentTime'](7);
tech.setCurrentTime(7);
seeking = true;
strictEqual(7, tech.currentTime(), 'during seeks the target time is returned');
});