@@ -513,13 +513,16 @@ function MSEStrategy(
513
513
function onCurrentTrackChanged ( event ) {
514
514
if ( ! isAudioDescribedAvailable ( ) ) return
515
515
516
+ audioDescribed . enable = isAudioDescribedEnabled ( )
516
517
const mediaType = event . newMediaInfo . type
518
+
517
519
DebugTool . info (
518
520
`${ mediaType } track changed.${
519
- mediaType === "audio" ? ( isAudioDescribedEnabled ( ) ? " Audio Described on." : " Audio Described off." ) : ""
521
+ mediaType === "audio" ? ( audioDescribed . enable ? " Audio Described on." : " Audio Described off." ) : ""
520
522
} `
521
523
)
522
- audioDescribed . callback && audioDescribed . callback ( isAudioDescribedEnabled ( ) )
524
+
525
+ audioDescribed . callback && audioDescribed . callback ( audioDescribed . enable )
523
526
}
524
527
525
528
function publishMediaState ( mediaState ) {
@@ -591,6 +594,16 @@ function MSEStrategy(
591
594
592
595
mediaPlayer . initialize ( mediaElement , null )
593
596
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
+
594
607
mediaPlayer . setInitialMediaSettingsFor (
595
608
"audio" ,
596
609
audioDescribed . enable
@@ -603,10 +616,6 @@ function MSEStrategy(
603
616
}
604
617
)
605
618
606
- modifySource ( presentationTimeInSeconds )
607
- }
608
-
609
- function modifySource ( presentationTimeInSeconds ) {
610
619
const source = mediaSources . currentSource ( )
611
620
const anchor = buildSourceAnchor ( presentationTimeInSeconds )
612
621
0 commit comments