private function initAdsLoader():void { ... adsLoader.addEventListener(AdErrorEvent.AD_ERROR, adsLoadErrorHandler);}private function adsLoadErrorHandler(event:AdErrorEvent):void { trace("warning", "Ads load error: " + event.error.errorMessage); videoPlayer.play();}
As previously announced, as of March 15th, 2018, the Google Media Framework (GMF) for Android is deprecated in favor of the IMA ExoPlayer plugin. All development and support for GMF has been halted. If you are a GMF Android user, we recommend you migrate to the IMA ExoPlayer plugin at your earliest convenience. Alternatively, to keep using GMF Android, you will have to fork and maintain it yourself.
Note: We are NOT deprecating GMF for iOS.
If you have any questions, feel free to contact us via the IMA SDK developer forum.
We’re excited to announce that we’ve teamed up with the Accelerated Mobile Pages team to bring you amp-ima-video, an IMA-SDK-enabled video player extension for AMP pages. This extension has been an AMP experiment for the past few months, but today we’re moving from experiment to public release.
amp-ima-video provides an AMP-enabled video player with the IMA SDK pre-integrated, so you can easily play and monetize content on your AMP pages. Simply provide your content URL and an ad tag, and we’ll handle playing back the video and ad(s). The extension currently supports linear in-stream single ads and VMAP playlists. To see it in action, check out the AMP by Example page for the extension.
amp-ima-video
If you have any questions or issues with the extension, please file them via the AMP issue tracker on GitHub.
With the release of v3.7.0 of the IMA iOS SDK, we will stop providing forum support and bug fixes for iOS IMA SDK issues specifically related to iOS 8 and below.
What does this mean if an app is currently targeting iOS 8?
What about other iOS versions?
We periodically stop supporting older iOS versions when adoption levels fall below a certain level. Whenever we end support for a major iOS release, we make announcements on our blog and release notes page.
As always, if you have any questions, feel free to reach out to us on our support forum.
MacOS High Sierra includes a new version of Safari, Safari 11. This new version by default will remove support for auto-playing videos unless they are muted. If your desktop site currently autoplays unmuted video with the IMA SDK, your users will see the first frame of the ad, but the ad will not play. To resolve this, you can either change your implementation to click-to-play, or attempt to autoplay and revert to click-to-play if that fails. We've also added a new error that will fire if the SDK is asked to autoplay an ad but is prevented from doing so by the browser. Continue reading for more info on these solutions.
The simple, advanced, and playlist IMA SDK samples use this click-to-play functionality. In short, you add a play button to your UI, and render that play button on page load. Your code should then delay calls to adDisplayContainer.initialize(), adsManager.init() and adsManager.start() until the user clicks that play button.
adDisplayContainer.initialize()
adsManager.init()
adsManager.start()
We've added a new sample to our GitHub repo, Attempt to Autoplay. This sample will autoplay ads if allowed, and if not, will follow the above click-to-play workflow. The sample starts by attempting to autoplay the content video. If autoplay succeeds, it pauses the content to play a pre-roll. This happens in an instant, so the users will not see any content actually play before the ads. If this autoplay attempt fails, the sample renders a play button and waits for the user to click that button to initialize the ad display container and play ads.
We've added AdError.ErrorCode.AUTOPLAY_DISALLOWED which the SDK will fire if it is asked to autoplay an ad but is prevented from doing so by the browser. You should not see this error if you've properly implemented one of the solutions above. This error is wrapped in a VIDEO_PLAY_ERROR; you can look for it as follows:
AdError.ErrorCode.AUTOPLAY_DISALLOWED
onAdError(adErrorEvent) { if (adErrorEvent.getError().getInnerError().getErrorCode() == google.ima.AdError.ErrorCode.AUTOPLAY_DISALLOWED) { // The browser prevented the SDK from autoplaying an ad. } }
If you have any questions, feel free to reach out to us on our support forum.
On March 15, 2018, we are stopping development and support for Google Media Framework (GMF) for Android in favor of the new ExoPlayer IMA extension. GMF's technology and approach are based on an older version of ExoPlayer.
The new v2 version of ExoPlayer and the ExoPlayer IMA Extension make basic integration simple enough that a layer between ExoPlayer and the IMA SDK is no longer necessary. The new approach is cleaner, requires less code, and uses the most up-to-date version of ExoPlayer.
Support for GMF for Android will end on March 15, 2018, after which we will no longer respond to issues or make any further releases of GMF for Android. The repository will also be shut down at this time. If you want to access the code, you can clone the repository before the March 15, 2018 shutdown date.
Users of ExoPlayer, an extensible, open-source media player for Android, can now easily integrate with the IMA SDK using the new ExoPlayer IMA extension. The IMA extension, released alongside ExoPlayer 2.5, wraps the IMA SDK for Android and provides seamless ad playback.
The extension ensures that ads are integrated into ExoPlayer's video timeline, and UI components are ad-aware. It also reduces buffering by eliminating the need to swap out and rebuffer the video player's source when transitioning between ads and content.
You can find more details on the extension in ExoPlayer's blog post on Medium, and find the extension on GitHub. If you have any questions or issues, please file them on ExoPlayer's issue tracker.
Starting with iOS 10, Safari on iPhone and iPod supports inline video playback. This opens up some new rendering options for your video player and the IMA SDK, but also introduces some caveats.
Previously, Safari on iPhone played all video in a fullscreen player. With iOS 10, Safari now supports the playsinline parameter on a video element to play that content inline.
playsinline
Fullscreen playback on iPhone Mobile Safari. The default with iOS 10+ and the only option for iOS <= 10
Inline playback on iPhone Mobile Safari. A new option in iOS 10+
On iPhone Safari, the IMA SDK re-uses your content player to play ads. We call this "custom playback." So if you add the playsinline parameter to your content video tag, IMA ads will also play inline - it's as easy as that.
Inline video playback also opens the door for the IMA SDK to play skippable ads on iPhone Mobile Safari. Previously these ads were dropped by the SDK because we could not render a skip button on top of the fullscreen player. If your player is inline, however, we can render that skip button, but there's a catch.
IMA SDK skippable ads are not supported with the "custom playback" method. To use skippable ads, you'll need to use our new API, ImaSdkSettings.setDisableCustomPlaybackForIOS10Plus(). This will cause the IMA SDK to render the ad in its own inline player on top of your content player. That player does support skippable ads. Disabling "custom playback", however, will break your fullscreen implementation for iPhone web.
ImaSdkSettings.setDisableCustomPlaybackForIOS10Plus()
The need for "custom playback" on iOS boils down to one thing - fullscreen support. Mobile Safari only supports fullscreen via videoPlayer.webkitEnterFullscreen(). In this mode, the SDK cannot render anything on top of your content player. Therefore, to support fullscreen ad playback we must use "custom playback".
videoPlayer.webkitEnterFullscreen()
Unfortunately, this is not possible on mobile Safari today - you must choose between support for skippable ads and support for fullscreen.
Prior versions of iOS (<10) do not have support for playsinline, so pages in those environments will always use "custom playback" mode, with support for fullscreen but no support for skippable ads.
That's OK! This is a complicated change with a lot of moving parts. Below is a support matrix outlining what is and is not supported based on your content player's playsinline mode and the "custom playback" mode you've set for the IMA SDK. Remember, this matrix only applies to iOS 10 and above - anything running version iOS 9 or below falls into the top left quadrant of the matrix, as this is the only option.
To help developers integrate with the IMA SDK, we're always looking for ways to provide both basic and advanced examples of features supported by the SDK. Toward this end, we're pleased to release a sample JavaScript VPAID creative and sample ad tag to aid in troubleshooting JavaScript VPAID 2.0 creatives. You can check out the new sample on GitHub, and find the new ad tag in our list of IMA sample tags as 'Sample VPAID 2.0 Linear'.
The VPAID sample plays a linear video ad and demonstrates the use of the video player proxy element required to run a VPAID ad in a secure iframe.
iframe
With the advent of video players that support streaming media formats such as HLS and DASH, publishers can now easily support these formats with the IMA SDK for Android. Here is a list of steps to make this work:
The latter is done via the SDK's AdsRenderingSettings API. Create a new instance of AdsRenderingSettings and then create a list of MIME types you plan to support:
AdsRenderingSettings
AdsRenderingSettings adsRenderingSettings = ImaSdkFactory.getInstance().createAdsRenderingSettings(); ArrayList arrayList = new ArrayList(); arrayList.add("application/x-mpegURL"); //HLS arrayList.add("application/dash+xml"); //DASH adsRenderingSettings.setMimeTypes(arrayList);
Then initialize the AdsManager using these AdsRenderingSettings:
adsManager.init(adsRenderingSettings);
This will allow the SDK to choose streaming ad media to play in your video player. Make sure to add any additional MIME types you plan to support, such as MP4, as this approach assumes that any MIME types not passed in are not supported.
How do I play HLS ads using the IMA SDK for iOS?
The default video player used by the iOS IMA SDK supports HLS, so it is not necessary to set that in AdsRenderingSettings.
Will this work with the SDK-owned player?
No, currently you must use custom playback by implementing the VideoAdPlayer interface. For an example of how to do this, check out our guide on custom playback or AdvancedExample.
VideoAdPlayer
If you have any questions, feel free to contact us via the support forum.
We're pleased to announce that we'll be holding a series of Display Ads API Workshops in April 2017. These workshops are a half-day of tech talks, group discussions, networking activities, and one-on-one time with Googlers geared toward developers who use the DoubleClick for Publishers API, Interactive Media Ads SDK, or Mobile Ads SDKs.
These workshops offer you the following:
The workshops will be held in the following cities:
For more information on the agenda and a preview of our talks, please see our workshop page.
As always, if you have any questions, feel free to drop us a line on the DFP API forums, IMA SDK forums, Mobile Ads SDK forums, or the Ads Developer Google+ page.
- Vincent Tsao, DFP API Team
One of the most important factors in keeping users on your page or in your app is latency - the lower your latency, the more likely your users are to stick around. With this in mind, we'd like to remind you about our best practices for reducing latency with the IMA SDKs. In general, you can reduce latency by doing as much IMA set-up work as possible on page or app load, before your user tries to play a video. The following can be done in all of the SDKs before the user attempts to play a video:
You can find more information on optimizing latency in each of our SDKs at the links below:
As always, if you have any questions, feel free to contact us via the support forum.
On June 1, 2017, Google will cease development of Flash in the IMA SDKs. This will end support for the IMA SDK for Flash, as well as support for Flash VPAID ads in the HTML5 SDK. We strongly encourage all publishers still using the Flash SDK to migrate to the HTML5 SDK. We also strongly encourage advertisers still trafficking Flash VPAID ads to migrate those ads to JavaScript VPAID.
We will not actively prevent ad serving to the Flash SDK. However, new releases will stop after June 1st and we will no longer fix bugs or answer support questions. If ad serving or playback stops working after this date for the Flash SDK, it will not be fixed. We strongly encourage you to migrate to the HTML5 SDK.
We will no longer support Flash VPAID ads in the HTML5 SDK. Flash VPAID ads served to the HTML5 SDK will not be rendered and the SDK will fire an error. We strongly encourage you to migrate your Flash VPAID ads to JavaScript VPAID.
On February 1, 2017, we will implement a new deprecation policy for the IMA SDKs for iOS and Android. The Flash and HTML5 SDKs are unaffected by this policy because they are downloaded at runtime, so all developers are always using the latest version.
Each release will be deprecated 12 months after its successor is released.
As of February 1, 2017, the following SDK versions will no longer be supported:
If you are currently on one of these versions, we strongly suggest upgrading to the latest version before the new policy takes effect.
Once an SDK version is deprecated, we cannot guarantee that version will continue to work. If we receive reports of crashes related to a deprecated version of the IMA SDK, we may discontinue serving ads to that version. We will also no longer field support requests for these versions on the IMA SDK support forum.
To maintain support, publishers on the latest version of an SDK will have 12 months to move to a new version once its successor is released. To "support" an SDK means we will investigate bugs in that SDK version and work on fixes. If a bug fix requires a change to the library itself, the fix will be applied to the newest version.
For a list of supported SDK versions and their deprecation dates, see the new deprecation schedule pages for iOS and Android. As always, if you have any questions, feel free to contact us via the support forum.
Integrating with the IMA SDK for Android has historically meant implementing the VideoAdPlayer interface and playing video ads in your content player. While this approach offers maximum flexibility, it also requires a lot of extra work to get up and running. In our mission to make developers' lives easier, we are proud to offer an alternative: SDK-owned ad playback, added in our newest release, v3.5.2.
Using SDK-owned ad playback, the SDK takes care of playing ads in its own player, allowing you to focus on content playback and the normal ad request flow in your player. With SDK-owned playback, you no longer have to implement a VideoAdPlayer, or worry about VideoAdPlayerCallbacks. Enabling SDK-owned playback is straightforward: simply omit the setAdPlayer call on your AdDisplayContainer.
AdDisplayContainer
With the new, simplified integration flow using SDK-owned playback, integrating with the IMA SDK for Android is easier than ever! For a step-by-step guide, head over to our revamped Get Started guide or download the BasicExample project from GitHub and try it out.
SDK-owned ad playback allows publishers to simplify their IMA implementation, but using it is not required. If you already have a VideoAdPlayer implementation or want to use a single video player for both ads and content, you can keep using custom playback. SDK-owned playback merely gives you the option to let the SDK handle some of the implementation complexity for you.
If you have any questions about SDK-owned playback, feel free to contact us via the support forum.
Have you ever asked yourself, Can I use the IMA SDK and Google Cast together to display videos with ads on a cast-enabled device? The answer is, yes you can!
We’ve put together a new section of guides and examples that show you how to add cast support to your IMA SDK implementation. They also explain the logic behind requesting ads on the sender and receiver devices. We’ve included both Android and iOS example sender apps, and an example HTML5 receiver.
We recommend familiarizing yourself with the Google Cast SDK as well as the IMA SDKs for Android, iOS and HTML5 before diving into these examples.
If you have any questions about these examples, feel free to contact us via the support forum.
We’ve seen an increase in support questions recently on fatal and non-fatal errors in the IMA SDKs, so we’re here to explain when and why each is fired, and how you should handle one versus the other.
Simply put, a fatal error is fired by the SDK when there is no chance for the SDK to play an ad for the remainder of the current video. There are two common scenarios for fatal ad errors. The first is when the SDK itself fails to load. The second (and more common) is when you are requesting one and only one ad, and that ad request fails to return a valid ad.
A non-fatal error is fired by the SDK when something goes wrong with an ad, but the SDK could potentially play other ads. The most common scenario for a non-fatal error occurs when you’re requesting a pod or playlist of ads, and one ad fails to load. Because it could still play other ads in that pod or playlist, the SDK fires a non-fatal error and moves on to attempt the next ad.
Fatal errors are what we call “top-level” errors. They trigger one of the following events, depending on your particular SDK:
Non-fatal errors are wrapped in a LOG type AdEvent. That event is sent to your AdsManager event listener or delegate. You can access the error message from the LOG event as follows:
When you get a fatal error, you should destroy your AdsManager and play your content video. When you get a non-fatal error, you are not obliged to do anything for video and ad playback to continue - you can log the error message using the snippets shown in the table above for informational purposes.
In our ongoing efforts to make developing with the IMA SDK easier, we’re pleased to announce that as of version 3.2.1, the IMA SDK for Android is now available on JCenter.
With this release, it's now quicker than ever to integrate with the IMA SDK. Simply make sure you include JCenter in your list of repositories:
repositories { jcenter() }
Then, in your build.gradle's dependencies, include the following compile directive:
build.gradle
compile
compile 'com.google.ads.interactivemedia.v3:interactivemedia:3.2.1'
If you're modifying an existing sample, make sure to remove the IMA SDK JAR file from your libs folder. This directive includes the SDK, and if you already have the SDK JAR in libs, you’ll get errors for having two copies of the same library.
libs
If you have any questions about these changes, feel free to contact us via the support forum.
We’re pleased to announce that the latest version of the IMA SDK for iOS, 3.2.0, supports compiling with bitcode enabled.
To enable/disable bitcode, go into Build Settings in your XCode project and toggle the 'Enable Bitcode' build option. For more information on bitcode, please see the developer documentation.
- Yury Pavlotsky, IMA SDK Team