با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
حالت های عملکرد SDK
SDK بسته به پاسخ تبلیغاتی که از سرور تبلیغات دریافت می کند، می تواند در یک یا چند حالت کار کند.
آگهی تک
تبلیغی که می تواند در هر زمانی که پیام start به IMAAdsManager ارسال می شود پخش شود. هیچ مقدار اولیه خاصی برای پخش یک تبلیغ لازم نیست.
غلاف آگهی
چندین تبلیغ که هنگام ارسال پیام start به IMAAdsManager پشت هم پخش می شوند. برای پخش یک آگهی تبلیغاتی نیازی به مقداردهی اولیه نیست.
قوانین آگهی
یک لیست پخش از وقفه های تبلیغاتی که در زمان های معینی برای محتوای خاص برنامه ریزی شده اند. پیام start در حالت قوانین آگهی نادیده گرفته می شود. ممکن است چندین وقفه تبلیغاتی در یک لیست پخش برنامه ریزی شده باشد (به عنوان مثال، قبل از پخش، میان پخش، پس از پخش). برای جزئیات بیشتر پیاده سازی، به بخش قوانین آگهی در زیر مراجعه کنید.
قوانین آگهی
IMA tvOS SDK از لیست پخش تبلیغات کاملاً خودکار پشتیبانی می کند. این ویژگی هنگام قاچاق تبلیغات شما، شکست های تبلیغاتی را همانطور که در Google Ad Manager مشخص شده است در محتوا قرار می دهد. همچنین کد پخشکننده ویدیو را که برای پشتیبانی از وقفههای تبلیغاتی، از جمله قبل از پخش، در میان پخش و پس از پخش ویدیو ضروری است، بسیار ساده میکند.
هنگام قاچاق تبلیغات در Ad Manager، می توان قوانین تبلیغاتی مختلفی مانند «همیشه در ابتدای محتوا پخش وقفه آگهی» یا «هر 30 دقیقه محتوا یک دقیقه استراحت آگهی پخش کرد» را مشخص کرد.
هنگامی که تبلیغات درخواست می شود، سرور تبلیغات می تواند لیست پخش آگهی را برگرداند. SDK لیست پخش را پردازش می کند و به طور خودکار وقفه های تبلیغاتی مشخص شده را برنامه ریزی می کند.
هنگام مقداردهی اولیه AdsManager ، یک شی IMAContentPlayhead از طریق تماس initializeWithContentPlayhead:adsRenderingSettings: ارسال می شود. اگر از AVPlayer برای نمایش محتوای خود استفاده می کنید، هنگام ایجاد adDisplayContainer خود، یک نمونه از IMAAVPlayerContentPlayhead را به SDK ارسال می کنید. این شیء برای ردیابی پیشرفت بازپخش محتوا استفاده می شود، بنابراین وقفه های تبلیغاتی به طور خودکار در زمان های مشخص شده در Ad Manager درج می شوند.
برای برگرداندن زمان فعلی پخش کننده ویدیو، currentTime را پیاده سازی کنید.
فراخوانی مقداردهی اولیه IMAAdsManager را برای استفاده از initializeWithContentPlayhead:self تغییر دهید.
IMAAdsManagerDelegate برای مکث و از سرگیری محتوا هنگام پخش وقفه های تبلیغاتی استفاده می شود.
توجه: هنگامی که پخش محتوا به پایان رسید یا کاربر پخش را متوقف کرد، حتماً contentComplete در IMAAdsLoader فراخوانی کنید تا به SDK سیگنال دهید که پخش محتوا به پایان رسیده است. SDK سپس وقفه تبلیغاتی پس از پخش را پخش می کند، در صورتی که برنامه ریزی شده باشد. رویداد ALL_ADS_COMPLETED زمانی مطرح میشود که همه وقفههای تبلیغاتی پخش شده باشند. علاوه بر این، توجه داشته باشید که ردیابی محتوا زمانی شروع میشود که متد IMAAdsManager 's initializeWithContentPlayhead:adsRenderingSettings فراخوانی میشود و همیشه باید قبل از پخش محتوا initializeWithContentPlayhead:adsRenderingSettings فراخوانی کنید.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\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."]]