इस गाइड में, विज्ञापन ब्रेक के डिफ़ॉल्ट शेड्यूल को बदलने और विज्ञापन ब्रेक के चलने के समय को कॉन्फ़िगर करने के बारे में निर्देश दिए गए हैं. मैन्युअल तरीके से विज्ञापन ब्रेक चलाने की सुविधा लागू होने पर, एसडीके AD_BREAK_READY इवेंट को तब ट्रिगर करता है, जब विज्ञापन ब्रेक लोड हो जाता है. इसके बाद, यह आपके निर्देश का इंतज़ार करता है, ताकि विज्ञापन ब्रेक का प्लेबैक शुरू किया जा सके.
ज़रूरी शर्तें
IMA SDK लागू किया गया Android ऐप्लिकेशन.
मैन्युअल तरीके से विज्ञापन ब्रेक चलाने की सुविधा कॉन्फ़िगर करना
मैन्युअल तरीके से विज्ञापन ब्रेक चलाने की सुविधा कॉन्फ़िगर करने के लिए:
एसडीके को बताएं कि आपको विज्ञापन ब्रेक के दौरान वीडियो चलाने की सुविधा को कंट्रोल करना है.
AD_BREAK_READY इवेंट को सुनें.
जब आप विज्ञापन दिखाने के लिए तैयार हों, तब SDK को विज्ञापन दिखाने के लिए कहें.
नीचे दिए गए स्निपेट में, मैन्युअल तरीके से विज्ञापन ब्रेक चलाने की सुविधा लागू करने के लिए, ऐडवांस उदाहरण में किए जाने वाले ज़रूरी बदलावों के बारे में बताया गया है.
publicVideoPlayerController(Contextcontext,VideoPlayerWithAdPlaybackvideoPlayerWithAdPlayback,ViewplayButton,ViewplayPauseToggle,Stringlanguage,ViewGroupcompanionViewGroup,Loggerlog){...sdkFactory=ImaSdkFactory.getInstance();ImaSdkSettingsimaSdkSettings=sdkFactory.createImaSdkSettings();imaSdkSettings.setLanguage(language);// Tell the SDK you want to control ad break playback.imaSdkSettings.setAutoPlayAdBreaks(false);...}...@OverridepublicvoidonAdEvent(AdEventadEvent){...switch(adEvent.getType()){// Listen for the AD_BREAK_READY event.caseAD_BREAK_READY:// Tell the SDK to play ads when you're ready. To skip this ad break,// simply return from this handler without calling adsManager.start().adsManager.start();break;...}
अक्सर पूछे जाने वाले सवाल
क्या IMA SDK लागू करने के लिए, मैन्युअल तरीके से विज्ञापन चलाने की सुविधा ज़रूरी है?
नहीं. मैन्युअल तरीके से विज्ञापन चलाने की सुविधा, उन पब्लिशर के लिए उपलब्ध है जो IMA SDK को विज्ञापन के नियमों या VMAP रिस्पॉन्स के हिसाब से, विज्ञापन के ब्रेक अपने-आप चलाने की अनुमति नहीं देना चाहते.
[null,null,["आखिरी बार 2025-08-31 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eThis guide explains how to manually control ad break playback timing in your Android app using the IMA SDK.\u003c/p\u003e\n"],["\u003cp\u003eBy disabling autoplay and listening for the \u003ccode\u003eAD_BREAK_READY\u003c/code\u003e event, you can trigger ad breaks at your desired moments.\u003c/p\u003e\n"],["\u003cp\u003eThis feature is optional and provides flexibility for publishers who need custom ad playback control beyond the default ad schedule.\u003c/p\u003e\n"],["\u003cp\u003eThe Advanced Example showcases the implementation, but the Basic Example with the Exoplayer-IMA extension cannot be used as a basis for this guide.\u003c/p\u003e\n"]]],[],null,["Select platform: [Android](/interactive-media-ads/docs/sdks/android/client-side/manual_ad_playback \"View this page for the Android platform docs.\") [iOS](/interactive-media-ads/docs/sdks/ios/client-side/manual_ad_playback \"View this page for the iOS platform docs.\")\n\n\u003cbr /\u003e\n\nThis guide provides instructions on overriding the default ad break schedule and\nconfiguring your own ad break playback timings. When manual ad break playback is\nimplemented, the SDK fires an `AD_BREAK_READY` event when an ad break has\nloaded, and waits on you to start the break's playback.\n\nPrerequisites\n\n- An Android application with the IMA SDK implemented.\n\nConfiguring manual ad break playback\n\nTo configure manual ad break playback:\n\n1. Tell the SDK you want to control ad break playback.\n2. Listen for the AD_BREAK_READY event.\n3. Tell the SDK to play ads when you're ready.\n\nThe snippet below shows the modifications required to the\n[Advanced Example](//github.com/googleads/googleads-ima-android/tree/main/AdvancedExample)\nto implement manual ad break playback.\n**Key Point:** The [Basic Example](//github.com/googleads/googleads-ima-android/tree/main/basicexample) implements the [Exoplayer-IMA extension](//github.com/google/ExoPlayer/tree/release-v2/extensions/ima) which handles the setup of ImaSdkSettings and AdEvents. Because of this, the Basic Example is not able to be used as a starting point for this guide. \n\n```carbon\npublic VideoPlayerController(\n Context context,\n VideoPlayerWithAdPlayback videoPlayerWithAdPlayback,\n View playButton,\n View playPauseToggle,\n String language,\n ViewGroup companionViewGroup,\n Logger log) {\n ...\n \n sdkFactory = ImaSdkFactory.getInstance();\n ImaSdkSettings imaSdkSettings = sdkFactory.createImaSdkSettings();\n imaSdkSettings.setLanguage(language);\n // Tell the SDK you want to control ad break playback.\n imaSdkSettings.setAutoPlayAdBreaks(false);\n \n ...\n}\n...\n@Override\npublic void onAdEvent(AdEvent adEvent) {\n ...\n switch (adEvent.getType()) {\n // Listen for the AD_BREAK_READY event.\n case AD_BREAK_READY:\n // Tell the SDK to play ads when you're ready. To skip this ad break,\n // simply return from this handler without calling adsManager.start().\n adsManager.start();\n break;\n ...\n}\n```\n\nFAQ\n\nIs manual ad playback required for an IMA SDK implementation?\n: No. manual ad playback is an optional feature for publishers who\n don't want the IMA SDK to automatically play ad breaks as scheduled by an ad\n rule or VMAP response."]]