exo_content_frame in a FrameLayout if your PlayerView has a custom layout. Point Gradle at your checkout and attach on the main thread after assigning the player.
stop() in onStop(), start() in onStart() and close() before releasing the view or player. The isPlayingAd() state covers ads that Media3 knows about. Use setLinearAdActive for externally stitched spots.
Remote control and product panel
On TV, the remote belongs to the ad. While an ad with something to act on is up (product tiles, a buy button or an open panel), the ad takes focus on its first tile. The arrows move between tiles without leaving the ad, and OK or Enter opens the product. Back or Escape goes back one step in the panel. When the panel closes, focus returns to the tile, or to the ad’s first tile if that one is gone; if there is no ad left, focus goes back to where it was before the ad took it. Back on a tile with no panel open stays the app’s. What changes for your app on TV. ThePlayerView receives the keys before the ad, so with its controls in use an arrow would only show them. For that reason, while such an ad is up, the SDK sets the controller aside with setUseController(false) and gives back the app’s value afterwards.
- If the app turns the controller on in the meantime, the app’s value stays. If the app turns it off in the meantime, it comes back on after the ad, because the SDK cannot tell that change from its own.
- The app’s
ControllerVisibilityListenersees the controller hide (GONE). The viewer sees the controls go while the ad is on screen, even if they were visible, and return afterwards. - Media keys (play/pause, play, pause, fast forward, rewind, next, previous) keep acting on the player meanwhile, as the Media3 controls would. The exception: if focus is on the
PlayerViewitself, or on an app view inside it, the media key reaches neither the SDK nor the controls, so handle it in the app (for example with aMediaSession). - The app does not need to add code. Nothing changes on phones for this part.
PlayerView ones (for example, Leanback transport controls), hide them or stop holding focus while an ad with something to act on is up, so that focus can reach the ad. The ad takes focus once when it appears, and takes it back if focus is left without an owner.
How long the panel stays (Android, phones and TV). The scene graphic lasts exactly its window. A panel the viewer opened stays open after its ad ends, with no time limit, until the viewer closes it. It also closes when:
- the viewer opens another product;
- a new ad break starts (in a break with several ads, each new ad closes the previous ad’s open product);
- the media changes;
- the app calls
stop()orclose(); - the
PlayerViewis detached from the window.
gradle -p android testDebugUnitTest connectedDebugAndroidTest with a test device or emulator. On the app’s target TV, check restore after an L, seek, background/foreground transitions and one collector receipt per visible cue. Shared fixture · Android project details
The library includes the Montserrat font for the product panels, so the AAR grows from about 150 KB to about 452 KB. See Typeface of the product panels in the Player SDK guide.
IL ads from the plan
AdPlanPlayer reads the IL plan, plays the breaks, draws the Super, the L, the Overlay 300×250 on phones and tablets (not on Android TV or Fire TV) and the product, and shows Buy during an iADServer ad. There are two ways to use it. Which to choose
The SDK requests the plan
In Settings → General → My own player, choose Media3 / ExoPlayer and register the value ofgetPackageName() in Package name of the Android app. load requests GET https://console.interactivelayers.com/il-player/app-plan?project=…&asset=…&app=android:<package name> off the main thread; start waits at most 5 s for the plan and then lets the content play.
- Without a plan, the content continues without ads and a single
plan_unavailablearrives with the reason (http_204,http_404,timeout,network,app_id,request,stitchedorinvalid) and theapp=sent. A404is the same answer for an unknown project, video or app: check the registration first. - A
version: 2plan expires after 120 s.loadrequests it again 20 s beforeexpires_atand, if that fails, at 12 and 5 s, with the same shopping session. It emitsplan_renewed, orplan_renew_failedonce, after the last attempt; on expiry,plan_expired, removes its graphics and returns to the content if it was in a break. If you bring the plan yourself, renew it withplan.replacePlan(json). - With
commerce.break_urlin the plan, the SDK requests the card of the iADServer ad playing and draws Buy until the ad ends; a panel the viewer opened stays. - On the Google Ad Manager requests it makes itself, the SDK adds
msid(package name) andan(app display name) when the tag lacks them; neverurlordescription_url. IMA adds the app identity on its own. - Lifecycle. Call
plan.close()inonDestroy()(in a fragment,onDestroyView()). If theActivityis destroyed withoutclose(), the SDK closes itself and emitsplan_closed(configuration_changeoractivity_destroyed). After a configuration change, such as a rotation, the app must callloadorattachagain with the newPlayerView; otherwise there are no ads and no Buy.
The app plays its breaks
If the app requests its breaks from the per-break API, your backend creates the playback with"graphics": true and passes GET /v1/vod/playbacks/{id}/plan (cuts: []) to the app. Connect it with attach and tell the SDK about each break and each ad. This mode needs neither IMA nor Google Mobile Ads.
- Report every break and every ad. The SDK applies
scenes.pacing.cut_clearance_secondsonly around the positions fromsetBreaksandbreakStarted. Without reports, graphics follow content time and there is no Buy. - Pass
nullas the session. Buy uses the plan’scommerce.session; with your ownsessionIdthe SDK emitsbuy_unavailableonce. Fetchad_tag_urlexactly as given. - The ad must show in the same
PlayerViewor under it, because Buy is drawn over thePlayerView. - If a reported break gets no call for 180 s in the foreground, the SDK ends it, emits
break_errorand draws again. The SDK never touches your player during your break.
Verification
Unit tests, and instrumented tests on an Android 15 phone emulator and an Android 14 Android TV emulator. Not tested on a physical device or with real Google Ad Manager, IMA or iADServer ads in the latest round. Fire TV was not tested: it is treated as Android TV by inference. A project with server-side insertion gets a plan the SDK refuses (stitched).
Ad plan on Android