@@ -201,6 +201,10 @@ app.controller('DashController', function ($scope, sources, contributors, dashif
201201 $scope . fastSwitchSelected = true ;
202202 $scope . ABRStrategy = 'abrDynamic' ;
203203
204+ // Persistent license
205+ $scope . licenseSessionId = { } ;
206+ $scope . selectedKeySystem = null ;
207+
204208 // Error management
205209 $scope . error = '' ;
206210 $scope . errorType = '' ;
@@ -294,6 +298,20 @@ app.controller('DashController', function ($scope, sources, contributors, dashif
294298 }
295299 } , $scope ) ;
296300
301+ $scope . player . on ( dashjs . MediaPlayer . events . KEY_SYSTEM_SELECTED , function ( e ) { /* jshint ignore:line */
302+ if ( e . data ) {
303+ $scope . selectedKeySystem = e . data . keySystem . systemString ;
304+ }
305+ } , $scope ) ;
306+
307+ $scope . player . on ( dashjs . MediaPlayer . events . KEY_SESSION_CREATED , function ( e ) { /* jshint ignore:line */
308+ if ( e . data ) {
309+ var session = e . data ;
310+ if ( session . getSessionType ( ) === 'persistent-license' ) {
311+ $scope . licenseSessionId [ $scope . selectedItem . url ] = session . getSessionID ( ) ;
312+ }
313+ }
314+ } , $scope ) ;
297315
298316 ////////////////////////////////////////
299317 //
@@ -366,6 +384,12 @@ app.controller('DashController', function ($scope, sources, contributors, dashif
366384 protData = null ;
367385 }
368386
387+ // Check if persistent license session ID is stored for current stream
388+ var sessionId = $scope . licenseSessionId [ $scope . selectedItem . url ] ;
389+ if ( sessionId ) {
390+ protData [ $scope . selectedKeySystem ] . sessionId = sessionId ;
391+ }
392+
369393 var bufferConfig = {
370394 liveDelay : $scope . defaultLiveDelay ,
371395 stableBufferTime : $scope . defaultStableBufferDelay ,
0 commit comments