diff --git a/contrib/akamai/controlbar/ControlBar.js b/contrib/akamai/controlbar/ControlBar.js index 4b5d13af6a..49cb791555 100644 --- a/contrib/akamai/controlbar/ControlBar.js +++ b/contrib/akamai/controlbar/ControlBar.js @@ -53,6 +53,7 @@ var ControlBar = function (dashjsMediaPlayer, displayUTCTimeCodes) { var videoControllerVisibleTimeout = 0; var liveThresholdSecs = 12; var textTrackList = {}; + var forceQuality = false; var video, videoContainer, videoController, @@ -845,7 +846,7 @@ var ControlBar = function (dashjsMediaPlayer, displayUTCTimeCodes) { if (item.index > 0) { cfg.streaming.abr.autoSwitchBitrate[item.mediaType] = false; self.player.updateSettings(cfg); - self.player.setQualityFor(item.mediaType, item.index - 1); + self.player.setQualityFor(item.mediaType, item.index - 1, forceQuality); } else { cfg.streaming.abr.autoSwitchBitrate[item.mediaType] = true; self.player.updateSettings(cfg); @@ -1015,6 +1016,10 @@ var ControlBar = function (dashjsMediaPlayer, displayUTCTimeCodes) { videoController.classList.remove('disable'); }, + forceQualitySwitch: function (value) { + forceQuality = value; + }, + resetSelectionMenus: function () { if (menuHandlersList.bitrate) { bitrateListBtn.removeEventListener('click', menuHandlersList.bitrate); diff --git a/index.d.ts b/index.d.ts index 240fcffa6c..4556be4683 100644 --- a/index.d.ts +++ b/index.d.ts @@ -464,7 +464,7 @@ declare namespace dashjs { getQualityFor(type: MediaType): number; - setQualityFor(type: MediaType, value: number): void; + setQualityFor(type: MediaType, value: number, replace?: boolean): void; updatePortalSize(): void; diff --git a/samples/dash-if-reference-player/app/main.js b/samples/dash-if-reference-player/app/main.js index 95ca5f09fc..0133b756ea 100644 --- a/samples/dash-if-reference-player/app/main.js +++ b/samples/dash-if-reference-player/app/main.js @@ -227,6 +227,7 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors' $scope.jumpGapsSelected = true; $scope.fastSwitchSelected = true; $scope.videoAutoSwitchSelected = true; + $scope.forceQualitySwitchSelected = false; $scope.videoQualities = []; $scope.ABRStrategy = 'abrDynamic'; @@ -537,6 +538,10 @@ app.controller('DashController', ['$scope', '$window', 'sources', 'contributors' }); }; + $scope.toggleForceQualitySwitch = function () { + $scope.controlbar.forceQualitySwitch($scope.forceQualitySwitchSelected); + }; + $scope.toggleScheduleWhilePaused = function () { $scope.player.updateSettings({ 'streaming': { diff --git a/samples/dash-if-reference-player/index.html b/samples/dash-if-reference-player/index.html index aba93a1942..802fca9b58 100644 --- a/samples/dash-if-reference-player/index.html +++ b/samples/dash-if-reference-player/index.html @@ -246,6 +246,12 @@ ng-change="toggleVideoAutoSwitch()" ng-checked="videoAutoSwitchSelected"> Video Auto Switch +