1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-25 11:13:52 +02:00

@dmlap move seek on replay into the flash tech. closes #2527

This commit is contained in:
David LaPalomento 2015-08-31 14:12:12 -04:00
parent c38778c296
commit 90c6890567
3 changed files with 26 additions and 0 deletions

View File

@ -109,6 +109,7 @@ CHANGELOG
* @gkatsev fixed nativeControlsForTouch handling. Defaults to native controls on iphone and native android browsers. ([view](https://github.com/videojs/video.js/pull/2499))
* @heff fixed cross-platform track tests by switching to a fake tech ([view](https://github.com/videojs/video.js/pull/2496))
* @gkatsev improved tech controls listener handling. ([view](https://github.com/videojs/video.js/pull/2511))
* @dmlap move seek on replay into the flash tech ([view](https://github.com/videojs/video.js/pull/2527))
--------------------

View File

@ -113,6 +113,9 @@ class Flash extends Tech {
* @method play
*/
play() {
if (this.ended()) {
this.setCurrentTime(0);
}
this.el_.vjs_play();
}

View File

@ -166,6 +166,28 @@ test('seekable', function() {
equal(result.length, mockFlash.duration_, 'seekable is empty with a zero duration');
});
test('play after ended seeks to the beginning', function() {
let plays = 0, seeks = [];
Flash.prototype.play.call({
el_: {
vjs_play() {
plays++;
}
},
ended() {
return true;
},
setCurrentTime(time) {
seeks.push(time);
}
});
equal(plays, 1, 'called play on the SWF');
equal(seeks.length, 1, 'seeked on play');
equal(seeks[0], 0, 'seeked to the beginning');
});
// fake out the <object> interaction but leave all the other logic intact
class MockFlash extends Flash {
constructor() {