@@ -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 ) ;
0 commit comments