Skip to content

Commit

Permalink
GetPlayingRange should only be used for live HLS; GetDuration should …
Browse files Browse the repository at this point in the history
…be used in all other circumstances.
  • Loading branch information
tsadler1988 committed Jun 28, 2017
1 parent 3ad0e82 commit a2fb309
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
17 changes: 15 additions & 2 deletions static/script-tests/tests/devices/mediaplayer/samsung_streaming.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@


/*HLS specific tests START*/
this.SamsungStreamingMediaPlayerTests.prototype.testPLayerOpenPluginThenHlsStartPlaybackCalledOnDeviceWhenBeginPlaybackFromCalledInStoppedState = function(queue) {
this.SamsungStreamingMediaPlayerTests.prototype.testPlayerOpenPluginThenHlsStartPlaybackCalledOnDeviceWhenBeginPlaybackFromCalledInStoppedState = function(queue) {
expectAsserts(9);
runMediaPlayerTest(this, queue, function(MediaPlayer) {
assert(playerPlugin.Open.notCalled);
Expand All @@ -276,7 +276,7 @@
assert(playerPlugin._methods.StartPlayback.calledOnce);
});
};
this.SamsungStreamingMediaPlayerTests.prototype.testPLayerOpenPluginThenHlsPlayCalledOnDeviceWhenBeginPlaybackFromCalledInStoppedState = function(queue) {
this.SamsungStreamingMediaPlayerTests.prototype.testPlayerOpenPluginThenHlsPlayCalledOnDeviceWhenBeginPlaybackFromCalledInStoppedState = function(queue) {
expectAsserts(8);
runMediaPlayerTest(this, queue, function(MediaPlayer) {
assert(playerPlugin.Open.notCalled);
Expand Down Expand Up @@ -518,6 +518,19 @@
assert(playerPlugin._methods.JumpForward.notCalled);
});
};

this.SamsungStreamingMediaPlayerTests.prototype.testHlsVodGetDurationUsedInsteadOfGetPlayingRange = function (queue) {
expectAsserts(4);
runMediaPlayerTest(this, queue, function(MediaPlayer) {
this._mediaPlayer.setSource(MediaPlayer.TYPE.VIDEO, 'testURL', 'application/vnd.apple.mpegurl');
this._mediaPlayer.beginPlaybackFrom(0);
deviceMockingHooks.sendMetadata(this._mediaPlayer, 0, { start: 0, end: 100 });

assert(playerPlugin._methods.GetPlayingRange.notCalled);
assert(playerPlugin._methods.GetDuration.calledOnce);
assertEquals(100, this._mediaPlayer.getDuration());
});
};
/*HLS specific tests END*/

this.SamsungStreamingMediaPlayerTests.prototype.testSetSourceInitPlayerFailsReturningZero = function(queue) {
Expand Down
4 changes: 2 additions & 2 deletions static/script/devices/mediaplayer/samsung_streaming.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ require.def(

_updateRange: function () {
var self = this;
if (this._currentPlayer === this.PlayerEmps.StreamingPlayer) {
if (this._isHlsMimeType() && this._isLiveMedia()) {
var range = this._playerPlugin.Execute('GetPlayingRange').split('-');
this._range = {
start: Math.floor(range[0]),
Expand All @@ -469,7 +469,7 @@ require.def(
setTimeout(function () {
self._updatingTime = false;
}, self.RANGE_UPDATE_TOLERANCE * 1000);
} else if (this._currentPlayer === this.PlayerEmps.Player) {
} else {
var duration = this._playerPlugin.Execute('GetDuration')/1000;
this._range = {
start: 0,
Expand Down

0 comments on commit a2fb309

Please sign in to comment.