mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-05-26 08:01:57 +00:00
fix(ios): retain cycle and memory leak involving the RCTVideo instance when using Google IMA ads in react-native-video. (#4574)
Co-authored-by: Varuzhan Khachatryan <varuzhan.khachatryan23@gmail.com>
This commit is contained in:
@@ -30,8 +30,13 @@
|
||||
|
||||
func requestAds() {
|
||||
guard let _video else { return }
|
||||
// fixes RCTVideo --> RCTIMAAdsManager --> IMAAdsLoader --> IMAAdDisplayContainer --> RCTVideo memory leak.
|
||||
let adContainerView = UIView(frame: _video.bounds)
|
||||
adContainerView.backgroundColor = .clear
|
||||
_video.addSubview(adContainerView)
|
||||
|
||||
// Create ad display container for ad rendering.
|
||||
let adDisplayContainer = IMAAdDisplayContainer(adContainer: _video, viewController: _video.reactViewController())
|
||||
let adDisplayContainer = IMAAdDisplayContainer(adContainer: adContainerView, viewController: _video.reactViewController())
|
||||
|
||||
let adTagUrl = _video.getAdTagUrl()
|
||||
let contentPlayhead = _video.getContentPlayhead()
|
||||
|
||||
Reference in New Issue
Block a user