@@ -491,6 +491,7 @@ class MediaView extends ComponentView {
491
491
} ) . removeClass ( 'inline-transcript-open' ) ;
492
492
$button . attr ( 'aria-expanded' , false ) ;
493
493
$buttonText . html ( this . model . get ( '_transcript' ) . inlineTranscriptButton ) ;
494
+ this . transcriptTriggers ( 'closed' ) ;
494
495
495
496
return ;
496
497
}
@@ -501,17 +502,23 @@ class MediaView extends ComponentView {
501
502
502
503
$button . attr ( 'aria-expanded' , true ) ;
503
504
$buttonText . html ( this . model . get ( '_transcript' ) . inlineTranscriptCloseButton ) ;
505
+ this . transcriptTriggers ( 'opened' ) ;
506
+ }
504
507
505
- if ( this . model . get ( '_transcript' ) . _setCompletionOnView !== false ) {
506
- Adapt . trigger ( 'media:transcriptComplete' , this ) ;
507
- this . setCompletionStatus ( ) ;
508
- }
508
+ onExternalTranscriptClicked ( ) {
509
+ this . transcriptTriggers ( 'external' ) ;
509
510
}
510
511
511
- onExternalTranscriptClicked ( event ) {
512
- if ( this . model . get ( '_transcript' ) . _setCompletionOnView === false ) return ;
513
- Adapt . trigger ( 'media:transcriptComplete' , this ) ;
512
+ transcriptTriggers ( state ) {
513
+ const setCompletionOnView = this . model . get ( '_transcript' ) . _setCompletionOnView ;
514
+ const isComplete = this . model . get ( '_isComplete' ) ;
515
+ const shouldComplete = ( setCompletionOnView && ! isComplete ) ;
516
+
517
+ if ( ! shouldComplete ) {
518
+ return Adapt . trigger ( 'media:transcript' , state , this ) ;
519
+ }
514
520
this . setCompletionStatus ( ) ;
521
+ Adapt . trigger ( 'media:transcript' , 'complete' , this ) ;
515
522
}
516
523
517
524
/**
0 commit comments