@@ -704,7 +704,6 @@ shaka.ads.InterstitialAdManager = class {
704
704
this . onEvent_ ( new shaka . util . FakeEvent (
705
705
shaka . ads . Utils . AD_SKIP_STATE_CHANGED ) ) ;
706
706
}
707
- const eventsSent = new Set ( ) ;
708
707
this . adEventManager_ . listenOnce ( this . player_ , 'error' , error ) ;
709
708
this . adEventManager_ . listen ( this . video_ , 'timeupdate' , ( ) => {
710
709
const duration = this . video_ . duration ;
@@ -718,23 +717,21 @@ shaka.ads.InterstitialAdManager = class {
718
717
new shaka . util . FakeEvent ( shaka . ads . Utils . AD_SKIP_STATE_CHANGED ) ) ;
719
718
}
720
719
prevCanSkipNow = currentCanSkipNow ;
721
- const currentPercent = 100 * this . video_ . currentTime / duration ;
722
- if ( currentPercent >= 25 && ! eventsSent . has ( 'firstquartile' ) ) {
723
- updateBaseVideoTime ( ) ;
724
- this . onEvent_ (
725
- new shaka . util . FakeEvent ( shaka . ads . Utils . AD_FIRST_QUARTILE ) ) ;
726
- eventsSent . add ( 'firstquartile' ) ;
727
- } else if ( currentPercent >= 50 && ! eventsSent . has ( 'midpoint' ) ) {
728
- updateBaseVideoTime ( ) ;
729
- this . onEvent_ (
730
- new shaka . util . FakeEvent ( shaka . ads . Utils . AD_MIDPOINT ) ) ;
731
- eventsSent . add ( 'midpoint' ) ;
732
- } else if ( currentPercent >= 75 && ! eventsSent . has ( 'thirdquartile' ) ) {
733
- updateBaseVideoTime ( ) ;
734
- this . onEvent_ (
735
- new shaka . util . FakeEvent ( shaka . ads . Utils . AD_THIRD_QUARTILE ) ) ;
736
- eventsSent . add ( 'thirdquartile' ) ;
737
- }
720
+ } ) ;
721
+ this . adEventManager_ . listenOnce ( this . player_ , 'firstquartile' , ( ) => {
722
+ updateBaseVideoTime ( ) ;
723
+ this . onEvent_ (
724
+ new shaka . util . FakeEvent ( shaka . ads . Utils . AD_FIRST_QUARTILE ) ) ;
725
+ } ) ;
726
+ this . adEventManager_ . listenOnce ( this . player_ , 'midpoint' , ( ) => {
727
+ updateBaseVideoTime ( ) ;
728
+ this . onEvent_ (
729
+ new shaka . util . FakeEvent ( shaka . ads . Utils . AD_MIDPOINT ) ) ;
730
+ } ) ;
731
+ this . adEventManager_ . listenOnce ( this . player_ , 'thirdquartile' , ( ) => {
732
+ updateBaseVideoTime ( ) ;
733
+ this . onEvent_ (
734
+ new shaka . util . FakeEvent ( shaka . ads . Utils . AD_THIRD_QUARTILE ) ) ;
738
735
} ) ;
739
736
this . adEventManager_ . listenOnce ( this . player_ , 'complete' , complete ) ;
740
737
this . adEventManager_ . listen ( this . video_ , 'play' , ( ) => {
0 commit comments