विज्ञापन बफ़र करने से जुड़े इवेंट पर नज़र रखना
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
इस गाइड में, विज्ञापन बफ़र करने की स्थिति के आधार पर कार्रवाई करने का तरीका बताया गया है.
अपने ऐप्लिकेशन में बफ़र इवेंट का इस्तेमाल करना
जब विज्ञापन बफ़र करने के लिए रुकते हैं, तब अपने ऐप्लिकेशन में गतिविधि का सूचक जोड़ने के लिए, IMAAdsManagerDelegate
पर इन डेलिगेट तरीकों का इस्तेमाल किया जा सकता है:
- (void)adsManagerAdDidStartBuffering(IMAAdsManager *)adsManager
: यह ट्रिगर तब होता है, जब पहले से चल रहा विज्ञापन बफ़र होने की वजह से रुक जाता है.
- (void)adsManager:(IMAAdsManager *)adsManager adDidBufferToMediaTime:(NSTimeInterval)mediaTime
:
इन्हें विज्ञापन बफ़र कहा जाता है. जब तक विज्ञापन बफ़र हो रहा है, तब तक इस तरीके को बार-बार कॉल किया जाता है.
- (void)adsManagerAdPlaybackReady:(IMAAdsManager *)adsManager
: इसे तब कॉल किया जाता है, जब मौजूदा विज्ञापन को इतना बफ़र कर लिया गया हो कि विज्ञापन चलाने के दौरान, बफ़र खत्म न हो.
उदाहरण
सभी बदलाव, iOS और tvOS, दोनों के लिए IMA SDK टूल के ऐडवांस सैंपल पर आधारित हैं:
@interface VideoViewController () <IMAAdsManagerDelegate,...>
...
@end
@implementation VideoViewController
...
- (void)adsManagerAdDidStartBuffering:(IMAAdsManager *)adsManager {
// Show your activity indicator above the video player - ad playback has
// stopped to buffer.
}
- (void)adsManagerAdPlaybackReady:(IMAAdsManager *)adsManager {
// Hide your activity indicator - as playback resumes.
}
अक्सर पूछे जाने वाले सवाल
क्या विज्ञापन शुरू होने से पहले, गतिविधि का कोई इंडिकेटर दिखाया जा सकता है?
हां, लेकिन हमारा सुझाव है कि आप उस इस्तेमाल के उदाहरण के लिए, डिलीगेट करने के अलग-अलग तरीकों का इस्तेमाल करें. [adsManager start]
को कॉल करने पर, गतिविधि का इंडिकेटर दिखाया जा सकता है. साथ ही, - (void)adsManager:(IMAAdsManager *)adsManager didReceiveAdEvent:(IMAAdEvent *)event
में kIMAAdEvent_STARTED
को पकड़ने पर, गतिविधि का इंडिकेटर छिपाया जा सकता है.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-08-31 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-08-31 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eThis guide provides instructions on how to leverage ad buffer events to display an activity indicator during ad buffering.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize the \u003ccode\u003eIMAAdsManagerDelegate\u003c/code\u003e methods, such as \u003ccode\u003eadsManagerAdDidStartBuffering\u003c/code\u003e, \u003ccode\u003eadsManager:adDidBufferToMediaTime:\u003c/code\u003e, and \u003ccode\u003eadsManagerAdPlaybackReady\u003c/code\u003e, to manage the activity indicator's visibility based on the ad's buffering state.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code example demonstrates how to integrate these methods into an iOS or tvOS application, using the IMA SDK Advanced Sample as a basis.\u003c/p\u003e\n"],["\u003cp\u003eWhile displaying an activity indicator before ad playback is possible, it's recommended to use different delegate methods and events like \u003ccode\u003e[adsManager start]\u003c/code\u003e and \u003ccode\u003ekIMAAdEvent_STARTED\u003c/code\u003e for that purpose.\u003c/p\u003e\n"]]],[],null,["# Monitor ad buffering events\n\nThis guide explains how to take action based on ad buffering state.\n\nUsing buffer events in your app\n-------------------------------\n\nYou can use the following delegate methods on `IMAAdsManagerDelegate` to add an\nactivity indicator to your app when ads pause to buffer:\n\n- `- (void)adsManagerAdDidStartBuffering(IMAAdsManager *)adsManager`: Called when an ad that already started playing has stopped to buffer.\n- `- (void)adsManager:(IMAAdsManager *)adsManager adDidBufferToMediaTime:(NSTimeInterval)mediaTime`: Called as an ad buffers. This method is called repeatedly as long as an ad is buffering.\n- `- (void)adsManagerAdPlaybackReady:(IMAAdsManager *)adsManager`: Called when the current ad is sufficiently buffered such that ad playback is not likely to outrun the buffer.\n\n### Example\n\nAll additions are based on the\n[IMA SDK Advanced Sample](//github.com/googleads/googleads-ima-ios/tree/master/Objective-C/AdvancedExample)\n(for both iOS and tvOS): \n\n```objective-c\n @interface VideoViewController () \u003cIMAAdsManagerDelegate,...\u003e\n\n ...\n\n @end\n\n @implementation VideoViewController\n\n ...\n\n - (void)adsManagerAdDidStartBuffering:(IMAAdsManager *)adsManager {\n // Show your activity indicator above the video player - ad playback has\n // stopped to buffer.\n }\n\n - (void)adsManagerAdPlaybackReady:(IMAAdsManager *)adsManager {\n // Hide your activity indicator - as playback resumes.\n }\n```\n\nFAQ\n---\n\n### Can I show an activity indicator before my ad starts playing?\n\nYes, but we recommend relying on different delegate methods for that\nuse case. You can show the activity indicator when you call `[adsManager start]`,\nand hide the activity indicator when you catch `kIMAAdEvent_STARTED` in\n`- (void)adsManager:(IMAAdsManager *)adsManager didReceiveAdEvent:(IMAAdEvent *)event`."]]