diff --git a/ios/Video/Features/RCTIMAAdsManager.swift b/ios/Video/Features/RCTIMAAdsManager.swift index 46a16b9e..26c6213e 100644 --- a/ios/Video/Features/RCTIMAAdsManager.swift +++ b/ios/Video/Features/RCTIMAAdsManager.swift @@ -44,6 +44,16 @@ } } + func releaseAds() { + guard let adsManager else { return } + // Destroy AdsManager may be delayed for a few milliseconds + // But what we want is it stopped producing sound immediately + // Issue found on tvOS 17, or iOS if view detach & STARTED event happen at the same moment + adsManager.volume = 0 + adsManager.pause() + adsManager.destroy() + } + // MARK: - Getters func getAdsLoader() -> IMAAdsLoader? { diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index cf73fb5b..0b1f430a 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -1187,6 +1187,10 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH _resouceLoaderDelegate = nil _playerObserver.clearPlayer() + #if USE_GOOGLE_IMA + _imaAdsManager.releaseAds() + #endif + self.removePlayerLayer() if let _playerViewController {