Skip to content

Commit ddcd41b

Browse files
authored
Merge pull request Dash-Industry-Forum#2830 from Orange-OpenSource/addInitialBitrateConf
Update Dash Reference Player supported config parameters
2 parents d45a04e + f692638 commit ddcd41b

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

samples/dash-if-reference-player/app/main.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ app.controller('DashController', function ($scope, sources, contributors, dashif
206206
$scope.localStorageSelected = true;
207207
$scope.jumpGapsSelected = true;
208208
$scope.fastSwitchSelected = true;
209+
$scope.videoAutoSwitchSelected = true;
210+
$scope.videoQualities = [];
209211
$scope.ABRStrategy = 'abrDynamic';
210212

211213
// Persistent license
@@ -279,6 +281,7 @@ app.controller('DashController', function ($scope, sources, contributors, dashif
279281
$scope.player.getDebug().setLogLevel(dashjs.Debug.LOG_LEVEL_INFO);
280282
$scope.player.initialize($scope.video, null, $scope.autoPlaySelected);
281283
$scope.player.setFastSwitchEnabled($scope.fastSwitchSelected);
284+
$scope.player.setAutoSwitchQualityFor('video', $scope.videoAutoSwitchSelected);
282285
$scope.player.setJumpGaps($scope.jumpGapsSelected);
283286
$scope.player.attachVideoContainer(document.getElementById('videoContainer'));
284287
// Add HTML-rendered TTML subtitles except for Firefox < v49 (issue #1164)
@@ -327,7 +330,6 @@ app.controller('DashController', function ($scope, sources, contributors, dashif
327330

328331
$scope.player.on(dashjs.MediaPlayer.events.QUALITY_CHANGE_RENDERED, function (e) { /* jshint ignore:line */
329332
$scope[e.mediaType + 'Index'] = e.newQuality + 1;
330-
$scope[e.mediaType + 'PendingIndex'] = e.newQuality + 1;
331333
$scope.plotPoint('index', e.mediaType, e.newQuality + 1, getTimeForPlot());
332334
$scope.safeApply();
333335
}, $scope);
@@ -339,6 +341,7 @@ app.controller('DashController', function ($scope, sources, contributors, dashif
339341
$scope.player.on(dashjs.MediaPlayer.events.STREAM_INITIALIZED, function (e) { /* jshint ignore:line */
340342
stopMetricsInterval();
341343

344+
$scope.videoQualities = $scope.player.getBitrateInfoListFor('video');
342345
$scope.chartCount = 0;
343346
$scope.metricsTimer = setInterval(function () {
344347
updateMetrics('video');
@@ -405,6 +408,10 @@ app.controller('DashController', function ($scope, sources, contributors, dashif
405408
$scope.player.setFastSwitchEnabled($scope.fastSwitchSelected);
406409
};
407410

411+
$scope.toggleVideoAutoSwitch = function () {
412+
$scope.player.setAutoSwitchQualityFor('video', $scope.videoAutoSwitchSelected);
413+
};
414+
408415
$scope.toggleScheduleWhilePaused = function () {
409416
$scope.player.setScheduleWhilePaused($scope.scheduleWhilePausedSelected);
410417
};
@@ -430,6 +437,10 @@ app.controller('DashController', function ($scope, sources, contributors, dashif
430437
$scope.optionsGutter = bool;
431438
};
432439

440+
$scope.selectVideoQuality = function (quality) {
441+
$scope.player.setQualityFor('video', quality);
442+
}
443+
433444
$scope.doLoad = function () {
434445
$scope.initSession();
435446

@@ -486,6 +497,10 @@ app.controller('DashController', function ($scope, sources, contributors, dashif
486497
$scope.player.setBufferTimeAtTopQuality(bufferConfig.bufferTimeAtTopQuality);
487498
$scope.player.setBufferTimeAtTopQualityLongForm(bufferConfig.bufferTimeAtTopQualityLongForm);
488499
$scope.player.setLowLatencyEnabled($scope.lowLatencyModeSelected || bufferConfig.lowLatencyMode);
500+
const initBitrate = parseInt($scope.initialVideoBitrate);
501+
if (!isNaN(initBitrate)) {
502+
$scope.player.setInitialBitrateFor('video', initBitrate);
503+
}
489504

490505
$scope.controlbar.reset();
491506
$scope.player.setProtectionData(protData);

samples/dash-if-reference-player/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@
133133
<div class="options-item">
134134
<div class="options-item-title">Playback</div>
135135
<div class="options-item-body">
136+
<label class="options-label">Playback Video quality:
137+
<div class="dropdown" data-toggle="tooltip" data-placement="left"
138+
title="Please select your video quality">
139+
<button class="btn btn-primary dropdown-toggle" type="button" id="menu1" data-toggle="dropdown">Set Video Quality
140+
<span class="caret"></span>
141+
</button>
142+
<ul class="dropdown-menu" role="menu" aria-labelledby="menu1">
143+
<li ng-repeat="bitrateInfo in videoQualities"><a ng-click="selectVideoQuality(bitrateInfo.qualityIndex)">{{bitrateInfo.qualityIndex + 1}}</a></li>
144+
</ul>
145+
</div>
146+
</label>
136147
<label class="topcoat-checkbox" data-toggle="tooltip" data-placement="right"
137148
title="Enables automatic startup of the media once the media is loaded">
138149
<input type="checkbox" ng-model="autoPlaySelected" ng-change="toggleAutoPlay()" ng-checked="autoPlaySelected">
@@ -168,6 +179,11 @@
168179
<input type="checkbox" id="fastSwitchCB" ng-model="fastSwitchSelected" ng-change="toggleFastSwitch()" ng-checked="fastSwitchSelected">
169180
Fast Switching ABR
170181
</label>
182+
<label class="topcoat-checkbox" data-toggle="tooltip" data-placement="right"
183+
title="Enables auto switch video quality using selected ABR strategy">
184+
<input type="checkbox" id="videoAutoSwitchCB" ng-model="videoAutoSwitchSelected" ng-change="toggleVideoAutoSwitch()" ng-checked="videoAutoSwitchSelected">
185+
Video Auto Switch
186+
</label>
171187
<label data-toggle="tooltip" data-placement="right"
172188
title="Dynamically switch between BOLA and Throughput strategies.">
173189
<input type="radio" id="abrDynamic" autocomplete="off" name="abrStrategy" checked="checked" ng-click="changeABRStrategy('abrDynamic')" >
@@ -213,6 +229,8 @@
213229
<div class="options-item">
214230
<div class="options-item-title">Initial Settings</div>
215231
<div class="options-item-body">
232+
<label class="options-label">Initial bitrate Video:</label>
233+
<input type="text" class="form-control" placeholder="value in kbps" ng-model="initialVideoBitrate">
216234
<label class="options-label">Audio:</label>
217235
<input type="text" class="form-control" placeholder="audio initial lang, e.g. 'en'" ng-model="initialSettings.audio">
218236
<label class="options-label">Video:</label>

0 commit comments

Comments
 (0)