iOS IMA SDK beta 14: Ads cannot be played and returned code 1010

967 views
Skip to first unread message

Paolo Martin Pascua

unread,
Jun 15, 2015, 10:01:43 AM6/15/15
to ima...@googlegroups.com
Hi,

We recently updated to beta 14 but tried loading the ad and it got the error 1010, saying that the sdk timed out. Reverting back to beta 13 can play the same ads again with no problems. Any insight of why this happens?

Thanks

tag:

Tyler Sidell (IMA SDK Team)

unread,
Jun 15, 2015, 2:11:13 PM6/15/15
to ima...@googlegroups.com
Hi Paolo,

Thank you for reaching out.  I'd be more than glad to help you.  Have you tested the ad tag with our provided video player examples?  I ran a test using beta 14 with the tag provided and was able to load the ad without any errors.  Could you please provide a link to your implementation or provide us with steps that we can use in order to try to reproduce?

Also, what version of iOS and device are you using?  Have you noticed this error across multiple devices?

Thanks,
Tyler Sidell
IMA SDK Team

Paolo Pascua

unread,
Jun 15, 2015, 2:57:21 PM6/15/15
to ima...@googlegroups.com
The actual request is this


Setup

- (IMASettings *)createIMASettings {
    IMASettings *settings = [[IMASettings alloc] init];
    settings.ppid = @"IMA_PPID_0";
    NSString *languageCode = [[DeviceInformation sharedInstance] getCurrentDeviceLocale];
    languageCode = [languageCode stringByReplacingOccurrencesOfString:@"-CA" withString:@""];
    DebugLog(@"Setting language: %@", languageCode);
    settings.language = languageCode;
    return settings;
}

- (void)setupAdsLoader {
    // Initalize Google IMA ads Loader.
    self.adsLoader =
    [[IMAAdsLoader alloc] initWithSettings:[self createIMASettings]];
    // Implement delegate methods to get callbacks from the adsLoader.
    self.adsLoader.delegate = self;
    //Adding this logic here to support in-app browser for More Details
    self.adsRenderingSettings = [[IMAAdsRenderingSettings alloc] init];
    self.adsRenderingSettings.bitrate = kIMAAutodetectBitrate;
    self.adsRenderingSettings.mimeTypes = @[];
    self.adsRenderingSettings.webOpenerDelegate = self;
    //We only support in-app browser if the delegate is an UIViewController
    if ([self.webViewPresenterController isKindOfClass:[UIViewController class]]){
        self.adsRenderingSettings.webOpenerPresentingController = (UIViewController*)self.webViewPresenterController;
    }
    else{
        self.adsRenderingSettings.webOpenerPresentingController = nil;
    }
}

- (void)foo {
….
….

        [self setupAdsLoader];

        

        self.adDisplayContainer = [[IMAAdDisplayContainer alloc]
                                   initWithAdContainer:self.qpPlayer.view
                                   companionSlots:nil];
        IMAAdsRequest *request =
        [[IMAAdsRequest alloc] initWithAdTagUrl:dfpUrl
                             adDisplayContainer:self.adDisplayContainer
                                    userContext:nil];

        

        DebugLog(@"Requesting DFPUrl: %@", dfpUrl);

        

        [self.adsLoader requestAdsWithRequest:request];
}



Paolo Pascua



--
You received this message because you are subscribed to a topic in the Google Groups "Interactive Media Ads SDK" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ima-sdk/CFzcAt6qXbs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ima-sdk+u...@googlegroups.com.
To post to this group, send email to ima...@googlegroups.com.
Visit this group at http://groups.google.com/group/ima-sdk.
For more options, visit https://groups.google.com/d/optout.

Tyler Sidell (IMA SDK Team)

unread,
Jun 16, 2015, 12:21:26 PM6/16/15
to ima...@googlegroups.com
Hi Paolo,

Thank you for providing that code sample.  We tested your code (on b13 & b14) and we're still not able to reproduce your error under normal network settings but it timeouts when the network is bad.  This is expected behavior for the SDK on a slow connection.  We believe that the issue is due to network latency and thus not an SDK issue.

Let us know if you have any questions,

Tyler Sidell
IMA SDK Team

Paolo Pascua

unread,
Jun 16, 2015, 12:58:43 PM6/16/15
to ima...@googlegroups.com
I recently found the issue where sometimes we receive adsLoader:adsLoadedWithData: and adsManagerDidRequestContentPause: delegates but after that it just left the player paused and never play the ads. It never receives the adsManager:didReceiveAdEvent: nor the failed callback. Later on I receive the ‘received warning message’. This is when I background the app while the ad is playing and foreground to retry playing ads again. Thoughts on this?


Paolo Pascua


Tyler Sidell (IMA SDK Team)

unread,
Jun 17, 2015, 10:51:06 AM6/17/15
to ima...@googlegroups.com
Hi Paolo,

As this seems to be a specific implementation, would you be able to provide us with a snippet of your code where you are calling adsLoadedWithData and adsManagerDidRequestContentPause?

Thanks,
Tyler Sidell
IMA SDK Team

Paolo Pascua

unread,
Jun 17, 2015, 10:56:29 AM6/17/15
to ima...@googlegroups.com
We just set the object as delegates of IMAAdsLoaderDelegate, and IMAAdsManagerDelegate. then we receive those calls and implemented logic to handle it

#pragma mark AdsLoader Delegate implementation

- (void)adsLoader:(IMAAdsLoader *)loader
adsLoadedWithData:(IMAAdsLoadedData *)adsLoadedData {
    DebugLog(@"Initializing ads manager");
    self.adsManager = adsLoadedData.adsManager;
    self.adsManager.delegate = self;
    self.adsRenderingSettings.bitrate = kIMAAutodetectBitrate;
    self.adsRenderingSettings.mimeTypes = @[];
    [self.adsManager initializeWithContentPlayhead:self
                              adsRenderingSettings:self.adsRenderingSettings];

    

}

- (void)adsLoader:(IMAAdsLoader *)loader
failedWithErrorData:(IMAAdLoadingErrorData *)adErrorData {
    DebugLog(@"Ad loading error: code:%d, message: %@",
     adErrorData.adError.code,
     adErrorData.adError.message);
    NSError* nsError = [NSError errorWithDomain:adErrorData.adError.message code:adErrorData.adError.code userInfo:nil];
    if ((self.playerDelegate) && [self.playerDelegate respondsToSelector:@selector(bellPlayerAdFailed:adType:withError:)]){
        [self.playerDelegate bellPlayerAdFailed:self adType:(BellPlayerAdPlacement)self.currentCuePoint.adPlacement withError:nsError];
    }
    [self adsManagerDidRequestContentResume:self.adsManager];
}

- (void)adsManagerDidRequestContentPause:(IMAAdsManager *)adsManager {
    //We pause the main content, remove if we want to give the client the ability to handle it
    DebugLog(@"We are requested to pause the main content, ad will start.");
    if ([self isPlaying]){
        //Live is Pausable now
        [self.qpPlayer pause];
    }
}


Paolo Pascua


Tyler Sidell (IMA SDK Team)

unread,
Jun 18, 2015, 8:50:55 AM6/18/15
to ima...@googlegroups.com
Hi Paolo,

Taking a look at the code, one recommendation I would suggest would be to modify the following:
[self.adsManager initializeWithContentPlayhead:self.contentPlayhead
                              adsRenderingSettings:self.adsRenderingSettings]; 

Give that a try and if it still doesn't resolve the issue, would you be able to provide the full implementation code?  You can message me privately or if you have a live environment, can you send that so that I can see this in action?  If you have detailed and specific steps to reproduce, that would be helpful as well.

Thanks,
Tyler Sidell
IMA SDK Team

...

rmodi

unread,
Jul 14, 2015, 10:27:07 PM7/14/15
to ima...@googlegroups.com
Hi Paolo,
We recently upgraded to beta 14 from beta 10. 
The ads and content play fine the first time. After that we are not able to play anything. The ad request is made but we get no callbacks at all.

Here is the relevant logging
 First TIme

VideoDisplayController: Requesting Ads tag: ..........

2015-07-14 19:19:07.954 ScrippsTV-WCPO[1712:610982] VideoDisplayController: Loaded ads.

2015-07-14 19:19:07.972 ScrippsTV-WCPO[1712:610982] VideoDisplayController: AdsManager Event: Loaded

2015-07-14 19:19:07.989 ScrippsTV-WCPO[1712:610982] VideoDisplayController: AdsManager requested content pause.

2015-07-14 19:19:08.050 ScrippsTV-WCPO[1712:610982] VideoDisplayController: AdsManager Event: Resume

2015-07-14 19:19:08.552 ScrippsTV-WCPO[1712:610982] VideoDisplayController: AdsManager Event: Started

2015-07-14 19:19:08.553 ScrippsTV-WCPO[1712:610982] Showing ad 1/1, bumper: NO

2015-07-14 19:19:08.553 ScrippsTV-WCPO[1712:610982] Ad info: title:15Jun19_figure_weight_loss_sha_shea_revised duration:15.000000 isSkippable:0

2015-07-14 19:19:13.204 ScrippsTV-WCPO[1712:610982] VideoDisplayController: AdsManager Event: First Quartile

2015-07-14 19:19:16.986 ScrippsTV-WCPO[1712:610982] VideoDisplayController: AdsManager Event: Midpoint

2015-07-14 19:19:20.790 ScrippsTV-WCPO[1712:610982] VideoDisplayController: AdsManager Event: Third Quartile

2015-07-14 19:19:24.769 ScrippsTV-WCPO[1712:610982] VideoDisplayController: AdsManager Event: Complete

2015-07-14 19:19:24.796 ScrippsTV-WCPO[1712:610982] VideoDisplayController: AdsManager requested content resume.

2015-07-14 19:19:24.909 ScrippsTV-WCPO[1712:610982] VideoDisplayController: AdsManager Event: All Ads Complete

2015-07-14 19:19:25.508 ScrippsTV-WCPO[1712:610982] VideoDisplayController: moviePlayerLoadStateChanged LoadState = 1

2015-07-14 19:19:30.967 ScrippsTV-WCPO[1712:610982] VideoDisplayController:  stopVideo



Second time for any ad code

VideoDisplayController: Requesting Ads ............

< NOTHING AFTER THIS>


Any suggestions where to look.  We have made no changes to the code since the b10 integration. I just upgraded the sdk.

We are on ios sdk 8.1. We use MPMoviePlayerController.


Thanks

Rahat Modi

rmodi

unread,
Jul 14, 2015, 10:31:55 PM7/14/15
to ima...@googlegroups.com
Sorry meant Tyler

Tyler Sidell (IMA SDK Team)

unread,
Jul 15, 2015, 11:00:47 AM7/15/15
to ima...@googlegroups.com
Hi Rahat,

Would you be able to provide me with your ad tag?  Are you seeing the same behavior when testing with our sample examples?

Thanks,
Tyler Sidell
IMA SDK Team

rmodi

unread,
Jul 15, 2015, 4:20:40 PM7/15/15
to ima...@googlegroups.com


After many hours of debugging I think I know what is causing the problem. BTW - I used the ad tags from your advanced sample and still had the problem and also tried my ad tags in your advanced sample and they work fine.

The problem is related to the ad's container view getting removed from the view hierarchy in didReceiveAdEvent:(IMAAdEvent *)event callback.

When all ads are done and all content is done playing I programmatically dismiss the view controller.

When I get kIMAAdEvent_ALL_ADS_COMPLETED, I destroy the adsmanager, set it to nil and dismiss the view controller if my content is done playing. This removes the ad's container view in this delegate callback. The next time I request an ad there is no response from the adLoader. This affects the case of post roll ads. If there are only preroll ads, then I do not have the problem since I do not dismiss the controller in kIMAAdEvent_ALL_ADS_COMPLETED.

To simulate the post roll ad scenario(could not find a post roll ad tag), I destroy the adsmanager, set it to nil and dismiss the view controller when I get kIMAAdEvent_ALL_ADS_COMPLETED. The next time you go play the ad nothing works.

Thanks

Rahat

Tyler Sidell (IMA SDK Team)

unread,
Jul 15, 2015, 4:33:01 PM7/15/15
to ima...@googlegroups.com
Thanks Rahat,

I'm glad that you were able to figure out the solution.  Please feel free to reach out to us if you have any further IMA questions.

Cheers,
Tyler Sidell
IMA SDK Team

rmodi

unread,
Jul 15, 2015, 9:18:13 PM7/15/15
to ima...@googlegroups.com
Hi Tyler,
Unfortunately I only figured out the problem. 
How do we fix this.  This was not an issue in the previous sdk beta 10.

If there are post roll ads, in adEvent callback  - kIMAAdEvent_ALL_ADS_COMPLETED  we dismiss the view controller which removes the view hierarchy.  This is what causes the ad system to freeze on the next video we want to show.
We would like the ability to automatically dismiss the controller when all ads and content done and the only place we have is kIMAAdEvent_ALL_ADS_COMPLETED.

Please can you advice.
Thanks
Rahat

Paolo Pascua

unread,
Jul 16, 2015, 8:23:53 AM7/16/15
to ima...@googlegroups.com
I think we had the same process as Rahat, when we delete the ads manager and the ads display container when all ads are finished, but we always generate a new ads manager and container when initiating ad playback. It doesn’t make sense why it doesn’t play anymore ads that way

Tyler Sidell (IMA SDK Team)

unread,
Jul 16, 2015, 11:56:23 AM7/16/15
to ima...@googlegroups.com
Hi Rahat,

From the comments that:
  • You used the ad tags from our advanced sample and still had the problem. 
  • Then you also tried your own ad tags in the advanced sample and they work fine.
It leads me to believe that it is something specific with your implementation. If you would provide me with some example code snippets I can take a further look.

Are you making the ads request using the same tag? If so, you may want to look at our documentation on requesting ads more than once.  You have to let the ad server know that these are legitimate requests and not duplicates.

It sounds like this may be what you're experiencing:
Call destroy() on your AdsManager instance. This prevents any post-rolls from playing when you make the below call to contentComplete().

Are you calling contentComplete() on your AdsLoader?

@Paolo, the suggestion is to only use one container and adsLoader per setup.  The only item that changes across ad requests is a new adsManager. 

Thanks,
Tyler Sidell
IMA SDK Team

...

rmodi

unread,
Jul 16, 2015, 3:22:44 PM7/16/15
to ima...@googlegroups.com

Hi Tyler
I modified the Basic sample (and attached it) to show you the problem and simulate as far as possible our usage.
I used the   kVMAPPodsTag because the I cannot find an ad tag that has post roll ads. Please substitute with something that you may have.
We use a MPMoviePlayerController in our app and no content playhead, Sample uses AV player with no content playhead.

We use only one AdsLoader in the app. The adDisplayContainer is created each time a request is made like in the samples.
When we play a video (press the play button) we create a new view. In that we create the player and the adDisplayContainer uses this view.
When user stops the video (pressing play button) or the content and ads are done we stop everything and remove the view.

There are 2 problems that we are having and need a solution for.

1) if there is a post roll ad and it is done, in the adEVent for all ads complete we cleanup the managers and views, Subsequently no ads play
2) In some cases we want to only play prerolls on the device - no content. For that when we get a call to resumeContent the first time we destroy the adsmanager and views ets. Subsequently no ads play.

At this point it looks like that in any adManager callback we can destroy the admanager, set it to nil, do the contentComplete , but if we have to destroy the view that was given to the displaycontainer in a callback things go bad after that.
Note there are no problems if the user stops the play at anytime since we are not in any adsManager callback.

Hopefully the attached project will help you.
If u don't want to use a post roll ad you can easily duplicate the problem in the sample I have attached by
in adEvent, for all All ad events complete comment out the line if(self.finishedContent) so that you destroy as soon as preroll ads are done.

Thanks for your help
Rahat
googleads_ima_ios_objc_basic_example.zip

Tyler Sidell (IMA SDK Team)

unread,
Jul 17, 2015, 11:42:33 AM7/17/15
to ima...@googlegroups.com
Hi Rahat,

Thank you for providing this information along with the sample app.  From the code that you provided, I am able to reproduce the issue that you are experiencing.

I'm noticing that you are calling contentComplete within the doCleanup function.  contentComplete should only be called when your content video finishes, not the ads.  You are calling it within contentDidFinishPlaying, so that part is fine.  But since doCleanup is also called when all ads have finished, I would suggest removing it from the function.  

Calling contentComplete after destroying the adsManager isn't necessary because when you call contentComplete, it lets the adsManager know that your video is done so that it can play any post-roll ads.  But if there's no more adsManager, the post-roll ads won't be played.  If your ad response does have post-rolls, you'll never get ALL_ADS_COMPLETED without first calling contentComplete.

Also, I would modify doCleanup and remove unloadContentPlayer.   You should only be destroying the adsLoader and/or adsManager.  

Modified doCleanup function:

-(void)doCleanup{
   
NSLog(@"doCleanup");
   
[self unloadAdsManager];
   
if(self.containerView){
     
[self.containerView removeFromSuperview];
     
self.containerView = nil;
   
}
}


Thanks,
Tyler Sidell
IMA SDK Team

rmodi

unread,
Jul 17, 2015, 12:32:46 PM7/17/15
to ima...@googlegroups.com
I am glad you see the problem. I will make these changes. Will it fix the problem?
 If not, can you suggest how we can exit and cleanup in an adsManager callback  - allAdsDone and resumeContent.

Also found out last night that this problem occurs in debug builds not release builds. The compiler optimization level is different for the 2 environments. Is this an issue with us moving from a library to framework ?

...

Tyler Sidell (IMA SDK Team)

unread,
Jul 17, 2015, 4:13:22 PM7/17/15
to ima...@googlegroups.com
Hi Rahat,

Those recommendations should fix your issue.  I was able to resolve the issue when I made those changes on the sample that you provided.  Also, you shouldn't experience this issue moving from a library to a framework.  It should follow the same logic.

Thanks,
Tyler Sidell
IMA SDK Team

rmodi

unread,
Aug 7, 2015, 11:34:01 AM8/7/15
to Interactive Media Ads SDK
Hi Tyler
I just wanted to update you on the latest.
The changes that you suggested did not fix the problem for me. I still had frozen ad requests.

I integrated the latest SDK  beta 15 based on the the release notes that destroy has been fixed and destruction in delegate methods fixed. That fixes the problem for me.

Thank you very much for all your help
Rahat
Reply all
Reply to author
Forward
0 new messages