fix(ios): resuming video ad after closing the in-app browser on iOS (#3275)
This commit is contained in:
parent
7b6b84c8cb
commit
e6e8f621fe
2
API.md
2
API.md
@ -667,7 +667,7 @@ Determine whether the media should played as picture in picture.
|
|||||||
* **false (default)** - Don't not play as picture in picture
|
* **false (default)** - Don't not play as picture in picture
|
||||||
* **true** - Play the media as picture in picture
|
* **true** - Play the media as picture in picture
|
||||||
|
|
||||||
NOTE: Video ads cannot start when you are using the PIP on iOS (more info available at [Google IMA SDK Docs](https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/picture_in_picture?hl=en#starting_ads)). If you are using custom controls, you must disable your PIP button when you receive the ```STARTED``` event from ```onReceiveAdEvent``` and show it again when you receive the ```ALL_ADS_COMPLETED``` event.
|
NOTE: Video ads cannot start when you are using the PIP on iOS (more info available at [Google IMA SDK Docs](https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/picture_in_picture?hl=en#starting_ads)). If you are using custom controls, you must hide your PIP button when you receive the ```STARTED``` event from ```onReceiveAdEvent``` and show it again when you receive the ```ALL_ADS_COMPLETED``` event.
|
||||||
|
|
||||||
Platforms: iOS
|
Platforms: iOS
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import GoogleInteractiveMediaAds
|
import GoogleInteractiveMediaAds
|
||||||
|
|
||||||
class RCTIMAAdsManager: NSObject, IMAAdsLoaderDelegate, IMAAdsManagerDelegate {
|
class RCTIMAAdsManager: NSObject, IMAAdsLoaderDelegate, IMAAdsManagerDelegate, IMALinkOpenerDelegate {
|
||||||
|
|
||||||
private weak var _video: RCTVideo?
|
private weak var _video: RCTVideo?
|
||||||
private var _pipEnabled:() -> Bool
|
private var _pipEnabled:() -> Bool
|
||||||
@ -65,6 +65,7 @@ class RCTIMAAdsManager: NSObject, IMAAdsLoaderDelegate, IMAAdsManagerDelegate {
|
|||||||
|
|
||||||
// Create ads rendering settings and tell the SDK to use the in-app browser.
|
// Create ads rendering settings and tell the SDK to use the in-app browser.
|
||||||
let adsRenderingSettings: IMAAdsRenderingSettings = IMAAdsRenderingSettings();
|
let adsRenderingSettings: IMAAdsRenderingSettings = IMAAdsRenderingSettings();
|
||||||
|
adsRenderingSettings.linkOpenerDelegate = self;
|
||||||
adsRenderingSettings.linkOpenerPresentingController = _video.reactViewController();
|
adsRenderingSettings.linkOpenerPresentingController = _video.reactViewController();
|
||||||
|
|
||||||
adsManager.initialize(with: adsRenderingSettings)
|
adsManager.initialize(with: adsRenderingSettings)
|
||||||
@ -125,6 +126,12 @@ class RCTIMAAdsManager: NSObject, IMAAdsLoaderDelegate, IMAAdsManagerDelegate {
|
|||||||
_video?.setPaused(false)
|
_video?.setPaused(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - IMALinkOpenerDelegate
|
||||||
|
|
||||||
|
func linkOpenerDidClose(inAppLink linkOpener: NSObject) {
|
||||||
|
adsManager?.resume()
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Helpers
|
// MARK: - Helpers
|
||||||
|
|
||||||
func convertEventToString(event: IMAAdEventType!) -> String {
|
func convertEventToString(event: IMAAdEventType!) -> String {
|
||||||
|
Loading…
Reference in New Issue
Block a user