diff --git a/CHANGELOG.md b/CHANGELOG.md index 809cb4526..65b014619 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) -------------------- diff --git a/src/js/tech/flash.js b/src/js/tech/flash.js index f6dff2f4f..4dc6bcbf0 100644 --- a/src/js/tech/flash.js +++ b/src/js/tech/flash.js @@ -113,6 +113,9 @@ class Flash extends Tech { * @method play */ play() { + if (this.ended()) { + this.setCurrentTime(0); + } this.el_.vjs_play(); } diff --git a/test/unit/tech/flash.test.js b/test/unit/tech/flash.test.js index 8c8a0c477..665281350 100644 --- a/test/unit/tech/flash.test.js +++ b/test/unit/tech/flash.test.js @@ -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 interaction but leave all the other logic intact class MockFlash extends Flash { constructor() {