1

I am using IMA SDK to play VAST ads. The ad video plays perfect but when I click on 'Learn More' button in the video ad, which opens in-app browser. After click on 'Done' in that window, the video ad is not resuming. Should i add something here to resume it ? I believe the SDK would handle this situation.

2 Answers 2

1

Need implement IMAWebOpenerDelegate

... var adsManager: IMAAdsManager! ... extension ViewController: IMAWebOpenerDelegate { func webOpenerDidClose(inAppBrowser webOpener: NSObject!) { print("closed") adsManager.resume() } func webOpenerDidOpen(inAppBrowser webOpener: NSObject!) { // Do something } func webOpenerWillClose(inAppBrowser webOpener: NSObject!) { // Do something } func webOpenerWillOpen(inAppBrowser webOpener: NSObject!) { // Do something } func webOpenerWillOpenExternalBrowser(_ webOpener: NSObject!) { // Do something } } 
Sign up to request clarification or add additional context in comments.

Comments

0

The idea is to have the user resume the Ad when your app regains focus. Keep in mind that a user might forget that the app was in the background so a user might be surprised to hear the app blaring an Ad once in focus.

  1. Add a play button overlay on the IMA player.

  2. Add a trigger to the button

    func playBtnPress(){ // make sure adsManager is initialized guard let adsManager = adsManager else { requestAds() // initialize adsManager return } // resume playback if paused if !adsManager.adPlaybackInfo.isPlaying { adsManager.resume() } } 

3.Add IMAAdsManagerDelegate

 func adsManager(_ adsManager: IMAAdsManager!, didReceive event: IMAAdEvent!) { if event.type == IMAAdEventType.LOADED { // When the SDK notifies us that ads have been loaded, play them. // hide play button first playButton.isHidden = true adsManager.start() } if event.type == IMAAdEventType.RESUME { // When the SDK notifies us that ads playback has resumed from a pause // hide play button playButton.isHidden = true } if event.type == IMAAdEventType.PAUSE { // When the SDK notifies us that ads playback is paused // Show play button playButton.isHidden = false } if event.type == IMAAdEventType.TAPPED { // You can also add allow the user to tap anywhere on the Ad to resume play if(!adsManager.adPlaybackInfo.isPlaying) { adsManager.resume() } } } 

1 Comment

you an also implement the IMAWebOpenerDelegate to listen to resume when the browser closes developers.google.com/interactive-media-ads/docs/sdks/ios/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.