@@ -513,13 +513,16 @@ function MSEStrategy(
513513 function onCurrentTrackChanged ( event ) {
514514 if ( ! isAudioDescribedAvailable ( ) ) return
515515
516+ audioDescribed . enable = isAudioDescribedEnabled ( )
516517 const mediaType = event . newMediaInfo . type
518+
517519 DebugTool . info (
518520 `${ mediaType } track changed.${
519- mediaType === "audio" ? ( isAudioDescribedEnabled ( ) ? " Audio Described on." : " Audio Described off." ) : ""
521+ mediaType === "audio" ? ( audioDescribed . enable ? " Audio Described on." : " Audio Described off." ) : ""
520522 } `
521523 )
522- audioDescribed . callback && audioDescribed . callback ( isAudioDescribedEnabled ( ) )
524+
525+ audioDescribed . callback && audioDescribed . callback ( audioDescribed . enable )
523526 }
524527
525528 function publishMediaState ( mediaState ) {
@@ -591,6 +594,16 @@ function MSEStrategy(
591594
592595 mediaPlayer . initialize ( mediaElement , null )
593596
597+ modifySource ( presentationTimeInSeconds )
598+ }
599+
600+ function modifySource ( presentationTimeInSeconds ) {
601+ if ( mediaPlayer . isReady ( ) ) {
602+ // Reset source to apply media settings for the new source
603+ // dash.js will reset media settings if a new source is attached while its initialised with a source
604+ mediaPlayer . attachSource ( null )
605+ }
606+
594607 mediaPlayer . setInitialMediaSettingsFor (
595608 "audio" ,
596609 audioDescribed . enable
@@ -603,10 +616,6 @@ function MSEStrategy(
603616 }
604617 )
605618
606- modifySource ( presentationTimeInSeconds )
607- }
608-
609- function modifySource ( presentationTimeInSeconds ) {
610619 const source = mediaSources . currentSource ( )
611620 const anchor = buildSourceAnchor ( presentationTimeInSeconds )
612621
0 commit comments