Closed webnard closed 10 months ago
Setting the currentTime on the AdEvent indeed 'is ignored' as the player is still in the context of playing the ad. You are receiving the adBreakEnd event at the time the ad has finished playing, but the player has not yet switched back to the main content. Setting the currentTime at this time is still trying to change the timeValue for the ad.
I quickly did a test on native iOS and noticed that you could for example use the CAN_PLAY event. And could combine this with a boolean that indicates an AdBreak just ended.
For example: (swift code from iOS test)
self.canPlayListener = player.addEventListener(type: PlayerEventTypes.CAN_PLAY) { event in
if self.adEnded {
player.currentTime = 60
self.adEnded = false
}
}
where you set self.adEnded on the AdBreakEnd event:
self.adBreakEndListener = player.ads.addEventListener(type: AdsEventTypes.AD_BREAK_END) { event in
self.adEnded = true
}
On RN the same flow should do the trick
Thanks, @wvanhaevre. This works. :)
I am testing IMA ads on iOS and trying to implement a workaround for https://github.com/THEOplayer/react-native-theoplayer/issues/207. The player ignores setting the
currentTime
value during anAD_BREAK_END
AD_EVENT
callback.