apple/ to your Xcode project and link ILAVPlayerOverlay to the iOS 16+ or tvOS 16+ target. Mount one video surface in a container whose rectangle the app controls. Place playback controls above it. The native Swift view uses the existing AVPlayer.
.hlsDateRanges mode reads dated HLS cues. For session JSON, initialize the view with .sidecar. Capture player.currentItem before fetching, then apply try surface.replaceSidecar(data, for: item) on the main actor. Keep responses ordered. AVPlayerItem.currentDate() needs a valid program date mapping in both modes.
Set surface.isInLinearAdBreak during externally stitched spots and isPresentationSuspended while another surface covers playback. Call surface.stop() to release observers and restore the original video rectangle. Run swift test and verify the HLS sample on the app’s target device. Watch layout restoration after a seek, pause and item change. Shared fixture and cue schema · Apple SDK documentation
IL ads from the plan
ILAdPlanPlayer reads the IL plan, plays the breaks, draws the Super, the L, the Overlay 300×250 on iOS and the product, and shows Buy during an iADServer ad. To play the breaks with IMA, add the ILAVPlayerOverlayIMA product and pass linearEngine: ILAdPlanIMA(overlay: overlay); without an engine, breaks use the VAST’s MP4. For the Overlay on iOS, add ILAVPlayerOverlayGMA and GADApplicationIdentifier in Info.plist. There are two ways to use it. Which to choose
The SDK requests the plan
In Settings → General → My own player, choose AVPlayer and register the bundle id in Bundle ID of the Apple app.load requests GET https://console.interactivelayers.com/il-player/app-plan?project=…&asset=…&app=apple:<bundle id>, over HTTPS only and without cookies, and never holds the content back for more than 5 seconds.
- Without a plan,
loadreturnsniland emitsplan_unavailableonce, with theapp=value asidand the reason as format:http_204(no plan yet, or a limit was reached),http_404(unknown project, video or app: check the registration first),timeout,network,app_id,stitchedorinvalid. The content plays anyway. - A
version: 2plan expires after 120 s.loadrequests it again up to three times, 20, 12 and 5 s before expiry, with the same shopping session, and stops at the first success (plan_renewed). Only if all three fail does it emitplan_renew_failed, once; on expiry it emitsplan_expired, removes what it drew and the content continues. If you get the plan yourself, renew it withreplacePlan(_:). - On the Google Ad Manager requests the SDK makes itself, it adds
msid(bundle id) andan(app name) when the tag lacks them, and neverurlordescription_url. Tags handed to IMA are left untouched: IMA adds the app identity on its own. - With
commerceEnabled = trueandcommerce.break_urlin the plan, the SDK requests the product when an iADServer ad with shopping starts and draws Buy while that ad lasts.
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 to the app. Attach that plan and tell the SDK about each break and each ad. It works with ILAVPlayerOverlay alone, without IMA or GMA.
- Report the breaks with
setBreaksbefore they arrive. The SDK appliesscenes.pacing.cut_clearance_secondsonly around reported breaks. Without reports, graphics follow content time and there is no Buy. - Do not pass your own
sessionID. Buy needs the session to be the plan’scommerce.session. If you pass another one and the plan hasbreak_url, the SDK says so once withbuy_unavailable(reasonsession). - Fetch
ad_tag_urlexactly as given, without touchingsidorcorrelator. - With a plan that carries its own breaks,
breakStartedis refused withbreak_refused(plan_has_cuts): two ways of driving breaks are never mixed. - A break without
breakEnded()is ended after 300 s withbreak_error. The SDK never pauses, seeks or replaces your item during your break.
Limits and verification
- The Overlay 300×250 is not available on tvOS: Google’s display SDK declares iOS only.
- The banner designed in iADServer is not drawn: the app shows the product card.
- On Apple, the Buy panel closes when the ad ends, even if the viewer opened it.
- A project with server-side insertion gets a plan the SDK refuses (
stitched): the app plays without IL ads. - Package tests run on Mac Catalyst and on the iPhone 17 and Apple TV 4K simulators, and the example app was tested on those simulators with a simulated ad: a local clip served by a local stand-in for the ad server. No real Google Ad Manager, IMA or iADServer ad was played, and nothing ran on an iPhone, an iPad or an Apple TV.