Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Modalità operative dell'SDK
L'SDK può funzionare in una o più modalità a seconda della risposta che riceve dall'annuncio stesso.
o server web.
Annuncio singolo
Un annuncio che può essere riprodotto in qualsiasi momento quando start
viene inviato a IMAAdsManager. Nessuna inizializzazione speciale
necessario per riprodurre un singolo annuncio.
Pod di annunci
Diversi annunci che vengono riprodotti in sequenza quando il messaggio start viene inviato a
IMAAdsManager. Non è necessaria alcuna inizializzazione speciale
riprodurre un singolo pod di annunci.
Regole per gli annunci
Una playlist di interruzioni pubblicitarie pianificate in determinati orari rispetto a un particolare
contenuti. Il messaggio start viene ignorato in modalità regole per gli annunci. È possibile
essere programmate in più interruzioni pubblicitarie all'interno di una singola playlist (ad es. pre-roll,
mid-roll, post-roll). Per ulteriori dettagli sull'implementazione, consulta
sezione Regole per gli annunci di seguito.
Regole per gli annunci
IMA
L'SDK tvOS supporta le playlist di annunci completamente automatizzate. Questa funzionalità
inserisce interruzioni pubblicitarie nei contenuti come specificato
Google Ad Manager
quando gestisci il traffico degli annunci. Inoltre, semplifica notevolmente il codice del video player
necessarie per supportare le interruzioni pubblicitarie, tra cui pre-roll, mid-roll e post-roll.
Quando gestisci il traffico degli annunci in Ad Manager, puoi specificare diverse regole per gli annunci
ad esempio "riproduci sempre l'interruzione pubblicitaria all'inizio dei contenuti" oppure "riproduci un'interruzione pubblicitaria di un minuto
ogni 30 minuti di contenuti".
Quando vengono richiesti gli annunci, l'ad server può restituire una playlist di annunci. L'SDK
elabora la playlist e pianifica automaticamente le interruzioni pubblicitarie
specificato.
Durante l'inizializzazione di AdsManager, viene generato un IMAContentPlayhead
viene trasmesso tramite l'elemento initializeWithContentPlayhead:adsRenderingSettings:
chiamata. Se utilizzi un AVPlayer per visualizzare i tuoi contenuti, passi un
di IMAAVPlayerContentPlayhead all'SDK quando crei
adDisplayContainer. Questo oggetto viene utilizzato per monitorare l'avanzamento della riproduzione di contenuti in modo che
vengono inserite automaticamente
nei momenti specificati in Ad Manager.
Implementa currentTime per restituire l'ora attuale della tua
video player.
Cambia la chiamata di inizializzazione di IMAAdsManager in
utilizza initializeWithContentPlayhead:self.
L'utente IMAAdsManagerDelegate
viene utilizzato per mettere in pausa e riprendere la riproduzione dei contenuti durante la riproduzione delle interruzioni pubblicitarie.
Nota:al termine della riproduzione dei contenuti o
l'utente ha interrotto la riproduzione; assicurati di chiamare contentComplete
su IMAAdsLoader per segnalare all'SDK che i contenuti
ha finito di giocare. L'SDK riproduce quindi l'interruzione pubblicitaria post-roll, se è stata pianificata.
L'evento ALL_ADS_COMPLETED viene generato quando tutte le interruzioni pubblicitarie hanno
è stato eseguito. Inoltre, tieni presente che il monitoraggio dei contenuti inizia quando
initializeWithContentPlayhead:adsRenderingSettings di IMAAdsManager
e devi sempre chiamare initializeWithContentPlayhead:adsRenderingSettings
prima di riprodurre i contenuti.
[null,null,["Ultimo aggiornamento 2025-08-31 UTC."],[[["\u003cp\u003eThe tvOS SDK utilizes a WebView for ad requests, parsing responses, tracking, and rendering the ad UI.\u003c/p\u003e\n"],["\u003cp\u003eIt supports various ad formats including single ads, ad pods, and ad rules (playlists of ad breaks).\u003c/p\u003e\n"],["\u003cp\u003eAd rules, managed through Google Ad Manager, allow for automated ad insertion at designated times within the content.\u003c/p\u003e\n"],["\u003cp\u003eThe SDK uses \u003ccode\u003eIMAContentPlayhead\u003c/code\u003e, which integrates with AVPlayer or a custom implementation, to synchronize ad breaks with content playback.\u003c/p\u003e\n"],["\u003cp\u003eUpon content completion, calling \u003ccode\u003econtentComplete\u003c/code\u003e on \u003ccode\u003eIMAAdsLoader\u003c/code\u003e triggers any scheduled post-roll ads and signals the completion of all ads.\u003c/p\u003e\n"]]],[],null,["# Automate ad playlists\n\n| **Note:** The tvOS SDK uses a WebView to load a JavaScript back end. This WebView is used to make ad requests, parse responses, ping tracking URLs, and render the ad UI.\n\nSDK operation modes\n-------------------\n\nThe SDK can operate in one or more modes, depending on the ad response it receives from the ad\nserver.\n\nSingle ad\n: An ad that can be played at any time when the `start`\n message is sent to the `IMAAdsManager`. No special initialization\n is necessary to play a single ad.\n:\n\nAd pod\n: Several ads that play back to back when the `start` message is sent to\n the `IMAAdsManager`. No special initialization is necessary to\n play a single ad pod.\n\nAd rules\n: A playlist of ad breaks scheduled at certain times against particular\n content. The `start` message is ignored in ad rules mode. There can\n be several ad breaks scheduled within a single playlist (e.g., pre-roll,\n mid-roll, post-roll). For further implementation details, see the\n [Ad Rules](#ad-rules) section below.\n\nAd rules\n--------\n\nIMA\ntvOS SDK supports fully automated ad playlists. This feature\ninserts ad breaks into the content as specified in\n[Google Ad Manager](//admanager.google.com/)\nwhen trafficking your ads. It also greatly simplifies the video player code\nnecessary to support ad breaks, including pre-rolls, mid-rolls, and post-rolls.\n\n- When trafficking ads in Ad Manager, it is possible to specify various ad rules like \"always play ad break at the beginning of the content\" or \"play a one-minute ad break every 30 minutes of content\".\n- When ads are requested, the ad server can return an ad playlist. The SDK processes the playlist and automatically schedules the ad breaks that have been specified.\n- When initializing the `AdsManager`, an `IMAContentPlayhead` object is passed in via the `initializeWithContentPlayhead:adsRenderingSettings:` call. If you are using an AVPlayer to display your content, you pass an instance of `IMAAVPlayerContentPlayhead` to the SDK when you create your `adDisplayContainer`. This object is used to track the progress of the content playback so ad breaks are automatically inserted at the times specified in Ad Manager. \n\n **With AVPlayer:** \n\n ```objective-c\n IMAContentPlayhead *contentPlayhead =\n [[IMAAVPlayerContentPlayhead alloc] initWithAVPlayer:self.contentAVPlayer];\n IMAAdsRequest *request = [[IMAAdsRequest alloc] initWithAdTagUrl:adTagUrl\n adDisplayContainer:adDisplayContainer\n contentPlayhead:contentPlayhead\n userContext:nil];\n ```\n\n **Without AVPlayer:**\n 1. Implement the `IMAContentPlayhead` interface.\n 2. Implement `currentTime` to return the current time of your video player.\n 3. Change the `IMAAdsManager` initialization call to use `initializeWithContentPlayhead:self`.\n- The [IMAAdsManagerDelegate](/interactive-media-ads/docs/sdks/tvos/client-side/reference/Protocols/IMAAdsManagerDelegate) is used to pause and resume the content as ad breaks are played.\n\n**Note:** When the content has finished playing or\nthe user has stopped playback, be sure to call `contentComplete`\non the `IMAAdsLoader` in order to signal to the SDK that the content\nhas finished playing. The SDK then plays the post-roll ad break, if one has been scheduled.\nThe `ALL_ADS_COMPLETED` event is raised when all ad breaks have\nbeen played. In addition, note that content tracking begins when\n`IMAAdsManager`'s `initializeWithContentPlayhead:adsRenderingSettings`\nmethod is called and you should always call `initializeWithContentPlayhead:adsRenderingSettings`\nbefore playing content."]]