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

@bc-bbay migrate seeking on replay to the flash tech. closes #2519

This commit is contained in:
Brandon Bay 2015-08-31 15:02:19 -04:00 committed by David LaPalomento
parent 75e65c6585
commit fca885a62f
3 changed files with 35 additions and 0 deletions

View File

@ -3,6 +3,7 @@ CHANGELOG
## HEAD (Unreleased)
* @dmlap update to videojs-swf 4.7.4 ([view](https://github.com/videojs/video.js/pull/2463))
* @bc-bbay migrate seeking on replay to the flash tech ([view](https://github.com/videojs/video.js/pull/2519))
--------------------

View File

@ -101,6 +101,10 @@ vjs.Flash.prototype.dispose = function(){
};
vjs.Flash.prototype.play = function(){
if (this.ended()) {
this['setCurrentTime'](0);
}
this.el_.vjs_play();
};

View File

@ -187,6 +187,36 @@ test('seekable should be empty if no video is loaded', function() {
equal(tech.seekable().length, 0, 'seekable is empty');
});
test('hitting play again after video ends resets current time to 0', function() {
var player = PlayerTest.makePlayer(),
currentTime = 60,
tech = new vjs.Flash(player, {
'parentEl': player.el()
});
// mock out currentTime
tech.el()['vjs_getProperty'] = function(name) {
if (name === 'currentTime') {
return currentTime;
}
if (name === 'ended') {
return true;
}
};
tech.el()['vjs_setProperty'] = function(property, value) {
if (property === 'currentTime') {
currentTime = value;
}
};
tech.el()['vjs_play'] = function() {};
tech.play();
equal(tech.currentTime(), 0, 'current time was not 0');
});
test('calling methods before the SWF loads is safe', function() {
var player = PlayerTest.makePlayer(),
tech = new vjs.Flash(player, {