الإعداد باستخدام ميزة "إدراج الإعلان الديناميكي" (DAI) في خدمة Pod

اختيار النظام الأساسي: HTML5 Android iOS tvOS Cast Roku

يتناول هذا الدليل كيفية دمج حزمة تطوير البرامج (SDK) لتقنية "إدراج الإعلان الديناميكي" (DAI) في "إعلانات الوسائط التفاعلية" (IMA) في تطبيق مشغّل فيديو. إذا أردت الاطّلاع على نموذج دمج مكتمل أو متابعته، يمكنك تنزيل PodServingExample من GitHub.

نظرة عامة على IMA DAI

يتضمن تنفيذ ميزة "إدراج الإعلان الديناميكي" في "حزمة تطوير البرامج لإعلانات الوسائط التفاعلية" أربعة مكوّنات رئيسية في حزمة تطوير البرامج (SDK)، كما يوضّح هذا الدليل:

  • ‫ IMAAdDisplayContainer: هو عنصر حاوية يقع فوق عنصر تشغيل الفيديو ويضم عناصر واجهة المستخدم الخاصة بالإعلان.
  • ‫ IMAAdsLoader: هو عنصر يطلب أحداثًا ويتعامل مع الأحداث التي يتم تشغيلها بواسطة عناصر استجابة طلب البث. يجب إنشاء مثيل واحد فقط من أداة تحميل الإعلانات، والذي يمكن إعادة استخدامه طوال مدة تشغيل التطبيق.
  • ‫ IMAStreamRequest: إما IMAPodVODStreamRequest أو IMAPodStreamRequest.
  • ‫ IMAStreamManager: هو عنصر يعالج أحداث البث والتفاعلات الخاصة بميزة "إدراج إعلان ديناميكي" مع الخلفية الخاصة بهذه الميزة. يتولّى مدير البث أيضًا تتبُّع إشعارات الاتصال وإعادة توجيه أحداث البث والإعلانات إلى الناشر.

بالإضافة إلى ذلك، لتشغيل أحداث البث المباشر التي تعرض مجموعات إعلانية متتالية، عليك تنفيذ معالج VTP مخصّص. يرسل معالج VTP المخصّص هذا معرّف البث إلى شريكك الفني في الفيديو (VTP) مع أي معلومات أخرى يحتاجها لعرض بيان بث يحتوي على كل من المحتوى والإعلانات المدمجة. يوفّر مزوّد تكنولوجيا الفيديو تعليمات حول كيفية تنفيذ معالج مزوّد تكنولوجيا الفيديو المخصّص.

المتطلبات الأساسية

قبل البدء، تحتاج إلى ما يلي:

ستحتاج أيضًا إلى المَعلمات لطلب البث من حزمة تطوير البرامج للإعلانات التفاعلية (IMA SDK).

مَعلمات البث المباشر
رمز الشبكة رمز الشبكة لحسابك على "إدارة إعلانات Google‏ 360"
مفتاح مادة العرض المخصّص مفتاح مادة العرض المخصّصة الذي يحدّد حدث "عرض الإعلانات في مجموعات" في "مدير الإعلانات 360". يتم إنشاء هذا الملف من خلال معالج البيان أو شريك عرض مجموعات الإعلانات المتتالية التابع لجهة خارجية.
مَعلمات بث الفيديو عند الطلب
رمز الشبكة رمز الشبكة لحسابك على "إدارة إعلانات Google‏ 360"

إنشاء مشروع Xcode جديد

في Xcode، أنشئ مشروع iOS جديدًا باستخدام Objective-C باسم "PodServingExample".

إضافة حزمة تطوير البرامج (SDK) لتقنية IMA DAI إلى مشروع Xcode

لتثبيت حزمة تطوير البرامج للإعلانات التفاعلية، اختَر الطريقة المفضّلة لديك.

الإجراء المقترَح: تثبيت حزمة تطوير البرامج (SDK) باستخدام Swift Package Manager

تتوافق حزمة تطوير البرامج لإعلانات الوسائط التفاعلية مع Swift Package Manager بدءًا من الإصدار 3.18.4. اتّبِع هذه الخطوات لاستيراد حزمة Swift.

  1. في Xcode، ثبِّت حزمة Swift Package الخاصة بحزمة تطوير البرامج (SDK) لتقنية IMA DAI: انتقِل إلى File > Add Packages.

  2. في الطلب الذي يظهر، ابحث عن مستودع GitHub لحزمة Swift Package الخاصة بـ IMA DAI SDK:

    https://github.com/googleads/swift-package-manager-google-interactive-media-ads-ios
    
  3. اختَر إصدار حزمة Swift Package من حزمة تطوير البرامج (SDK) لتقنية IMA DAI الذي تريد استخدامه. بالنسبة إلى المشاريع الجديدة، استخدِم Up to Next Major Version.

بعد الانتهاء، يحلّ Xcode التبعيات المرتبطة بحِزمك وينزّلها في الخلفية. لمزيد من التفاصيل حول كيفية إضافة تبعيات الحِزم، يُرجى الاطّلاع على مقالة Apple.

تنزيل حزمة SDK وتثبيتها يدويًا

إذا كنت لا تريد استخدام Swift Package Manager، يمكنك تنزيل حزمة تطوير البرامج للإعلانات التفاعلية (IMA SDK) وإضافتها يدويًا إلى مشروعك.

إنشاء مشغّل فيديو

نفِّذ مشغّل فيديو في وحدة التحكّم في العرض الرئيسية، وأدرِج مشغّل AV في عرض واجهة المستخدم. تستخدم حزمة تطوير البرامج للإعلانات التفاعلية (IMA SDK) طريقة عرض واجهة المستخدم لعرض عناصر في واجهة المستخدم الخاصة بالإعلانات.

Objective-C

#import "ViewController.h"

#import <AVKit/AVKit.h>

/// Content URL.
static NSString *const kBackupContentUrl =
    @"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8";

@interface ViewController ()
/// Play button.
@property(nonatomic, weak) IBOutlet UIButton *playButton;

@property(nonatomic, weak) IBOutlet UIView *videoView;
/// Video player.
@property(nonatomic, strong) AVPlayer *videoPlayer;
@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  self.view.backgroundColor = [UIColor blackColor];

  // Load AVPlayer with the path to your content.
  NSURL *contentURL = [NSURL URLWithString:kBackupContentUrl];
  self.videoPlayer = [AVPlayer playerWithURL:contentURL];

  // Create a player layer for the player.
  AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.videoPlayer];

  // Size, position, and display the AVPlayer.
  playerLayer.frame = self.videoView.layer.bounds;
  [self.videoView.layer addSublayer:playerLayer];
}

- (IBAction)onPlayButtonTouch:(id)sender {
  [self.videoPlayer play];
  self.playButton.hidden = YES;
}

@end

Swift

// Copyright 2024 Google LLC. All rights reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
// ANY KIND, either express or implied. See the License for the specific language governing
// permissions and limitations under the License.

import AVFoundation
import UIKit

class ViewController: UIViewController {

  /// Content URL.
  static let backupStreamURLString =
    "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"

  /// Play button.
  @IBOutlet private weak var playButton: UIButton!

  @IBOutlet private weak var videoView: UIView!
  /// Video player.
  private var videoPlayer: AVPlayer?

  override func viewDidLoad() {
    super.viewDidLoad()

    playButton.layer.zPosition = CGFloat(MAXFLOAT)

    // Load AVPlayer with path to our content.
    // note: this unwrap is safe because the URL is a constant string.
    let contentURL = URL(string: ViewController.backupStreamURLString)!
    videoPlayer = AVPlayer(url: contentURL)

    // Create a player layer for the player.
    let playerLayer = AVPlayerLayer(player: videoPlayer)

    // Size, position, and display the AVPlayer.
    playerLayer.frame = videoView.layer.bounds
    videoView.layer.addSublayer(playerLayer)
  }

  @IBAction func onPlayButtonTouch(_ sender: Any) {
    videoPlayer?.play()
    playButton.isHidden = true
  }
}

إعداد أداة تحميل الإعلانات

استورِد حزمة تطوير البرامج للإعلانات التفاعلية (IMA SDK) إلى وحدة التحكّم في العرض واعتمد بروتوكولَي IMAAdsLoaderDelegate وIMAStreamManagerDelegate للتعامل مع أحداث أداة تحميل الإعلانات ومدير البث.

أضِف هذه السمات الخاصة لتخزين مكوّنات حزمة تطوير البرامج للإعلانات التفاعلية (IMA SDK) الرئيسية:

  • IMAAdsLoader
    • يدير طلبات البث طوال فترة استخدام تطبيقك.
  • IMAAdDisplayContainer
    • تتولّى هذه الفئة إدراج عناصر واجهة مستخدم الإعلانات وإدارتها.
  • IMAAVPlayerVideoDisplay - يتيح التواصل بين حزمة تطوير البرامج للإعلانات التفاعلية (IMA SDK) ومشغّل الوسائط ويتعامل مع البيانات الوصفية المحدّدة زمنيًا.
  • IMAStreamManager: تُدير تشغيل البث وتُطلق الأحداث ذات الصلة بالإعلانات.

يجب إعداد أداة تحميل الإعلانات وحاوية عرض الإعلانات وعرض الفيديو بعد تحميل العرض.

Objective-C

@import GoogleInteractiveMediaAds;

// ...

@interface ViewController () <IMAAdsLoaderDelegate, IMAStreamManagerDelegate>
/// The entry point for the IMA DAI SDK to make DAI stream requests.
@property(nonatomic, strong) IMAAdsLoader *adsLoader;
/// The container where the SDK renders each ad's user interface elements and companion slots.
@property(nonatomic, strong) IMAAdDisplayContainer *adDisplayContainer;
/// The reference of your video player for the IMA DAI SDK to monitor playback and handle timed
/// metadata.
@property(nonatomic, strong) IMAAVPlayerVideoDisplay *imaVideoDisplay;
/// References the stream manager from the IMA DAI SDK after successful stream loading.
@property(nonatomic, strong) IMAStreamManager *streamManager;

// ...

@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];

  // ...

  self.adsLoader = [[IMAAdsLoader alloc] initWithSettings:nil];
  self.adsLoader.delegate = self;

  // Create an ad display container for rendering each ad's user interface elements and companion
  // slots.
  self.adDisplayContainer =
      [[IMAAdDisplayContainer alloc] initWithAdContainer:self.videoView
                                          viewController:self
                                          companionSlots:nil];

  // Create an IMAAVPlayerVideoDisplay to give the SDK access to your video player.
  self.imaVideoDisplay = [[IMAAVPlayerVideoDisplay alloc] initWithAVPlayer:self.videoPlayer];
}

Swift

import GoogleInteractiveMediaAds
// ...

class ViewController: UIViewController, IMAAdsLoaderDelegate, IMAStreamManagerDelegate {
  // ...

  /// The entry point for the IMA DAI SDK to make DAI stream requests.
  private var adsLoader: IMAAdsLoader?
  /// The container where the SDK renders each ad's user interface elements and companion slots.
  private var adDisplayContainer: IMAAdDisplayContainer?
  /// The reference of your video player for the IMA DAI SDK to monitor playback and handle timed
  /// metadata.
  private var imaVideoDisplay: IMAAVPlayerVideoDisplay!
  /// References the stream manager from the IMA DAI SDK after successfully loading the DAI stream.
  private var streamManager: IMAStreamManager?

  // ...

  override func viewDidLoad() {
    super.viewDidLoad()

    // ...

    adsLoader = IMAAdsLoader(settings: nil)
    adsLoader?.delegate = self

    // Create an ad display container for rendering each ad's user interface elements and companion
    // slots.
    adDisplayContainer = IMAAdDisplayContainer(
      adContainer: videoView,
      viewController: self,
      companionSlots: nil)

    // Create an IMAAVPlayerVideoDisplay to give the SDK access to your video player.
    imaVideoDisplay = IMAAVPlayerVideoDisplay(avPlayer: videoPlayer)
  }

تقديم طلب بث

عندما يضغط المستخدم على زر التشغيل، أرسِل طلب بث جديد. استخدِم الفئة IMAPodStreamRequest لأحداث البث المباشر. بالنسبة إلى أحداث البث المباشر للفيديو عند الطلب، استخدِم الفئة IMAPodVODStreamRequest.

يتطلّب طلب البث مَعلمات البث، بالإضافة إلى مرجع إلى حاوية عرض الإعلانات وعرض الفيديو.

Objective-C

- (IBAction)onPlayButtonTouch:(id)sender {
  [self requestStream];
  self.playButton.hidden = YES;
}

- (void)requestStream {
  // Create a stream request.
  IMAStreamRequest *request;
  if (kStreamType == StreamTypeLive) {
    // Live stream request. Replace the network code and custom asset key with your values.
    request = [[IMAPodStreamRequest alloc] initWithNetworkCode:kNetworkCode
                                                customAssetKey:kCustomAssetKey
                                            adDisplayContainer:self.adDisplayContainer
                                                  videoDisplay:self.imaVideoDisplay
                                         pictureInPictureProxy:nil
                                                   userContext:nil];
  } else {
    // VOD request. Replace the network code with your value.
    request = [[IMAPodVODStreamRequest alloc] initWithNetworkCode:kNetworkCode
                                               adDisplayContainer:self.adDisplayContainer
                                                     videoDisplay:self.imaVideoDisplay
                                            pictureInPictureProxy:nil
                                                      userContext:nil];
  }
  [self.adsLoader requestStreamWithRequest:request];
}

Swift

@IBAction func onPlayButtonTouch(_ sender: Any) {
  requestStream()
  playButton.isHidden = true
}

func requestStream() {
  // Create a stream request. Use one of "Livestream request" or "VOD request".
  if ViewController.requestType == StreamType.live {
    // Livestream request.
    let request = IMAPodStreamRequest(
      networkCode: ViewController.networkCode,
      customAssetKey: ViewController.customAssetKey,
      adDisplayContainer: adDisplayContainer!,
      videoDisplay: self.imaVideoDisplay,
      pictureInPictureProxy: nil,
      userContext: nil)
    adsLoader?.requestStream(with: request)
  } else {
    // VOD stream request.
    let request = IMAPodVODStreamRequest(
      networkCode: ViewController.networkCode,
      adDisplayContainer: adDisplayContainer!,
      videoDisplay: self.imaVideoDisplay,
      pictureInPictureProxy: nil,
      userContext: nil)
    adsLoader?.requestStream(with: request)
  }
}

الاستماع إلى أحداث تحميل البث

تستدعي الفئة IMAAdsLoader الطرق IMAAdsLoaderDelegate عند نجاح عملية الإعداد أو تعذُّر طلب البث.

في طريقة التفويض adsLoadedWithData، اضبط IMAStreamManagerDelegate. مرِّر رقم تعريف مصدر البيانات إلى معالج VTP المخصّص، واسترجع عنوان URL لبيان مصدر البيانات. بالنسبة إلى أحداث البث المباشر، حمِّل عنوان URL الخاص بملف البيان في شاشة عرض الفيديو، وابدأ التشغيل. بالنسبة إلى أحداث البث المباشر للفيديوهات عند الطلب، مرِّر عنوان URL الخاص بملف البيان إلى طريقة loadThirdPartyStream في مدير أحداث البث المباشر. تطلب هذه الطريقة بيانات أحداث الإعلانات من "إدارة إعلانات Google‏ 360"، ثم تحمّل عنوان URL للبيان وتبدأ التشغيل.

في طريقة التفويض failedWithErrorData ، سجِّل الخطأ. يمكنك تشغيل البث الاحتياطي إذا أردت. يمكنك الاطّلاع على أفضل الممارسات المتعلّقة بإدراج الإعلانات الديناميكية.

Objective-C

- (void)adsLoader:(IMAAdsLoader *)loader adsLoadedWithData:(IMAAdsLoadedData *)adsLoadedData {
  NSLog(@"Stream created with: %@.", adsLoadedData.streamManager.streamId);
  self.streamManager = adsLoadedData.streamManager;
  self.streamManager.delegate = self;

  // Build the Pod serving Stream URL.
  NSString *streamID = adsLoadedData.streamManager.streamId;
  // Your custom VTP handler takes the stream ID and returns the stream manifest URL.
  NSString *urlString = gCustomVTPHandler(streamID);
  NSURL *streamUrl = [NSURL URLWithString:urlString];
  if (kStreamType == StreamTypeLive) {
    // Load live streams directly into the AVPlayer.
    [self.imaVideoDisplay loadStream:streamUrl withSubtitles:@[]];
    [self.imaVideoDisplay play];
  } else {
    // Load VOD streams using the `loadThirdPartyStream` method in IMA SDK's stream manager.
    // The stream manager loads the stream, requests metadata, and starts playback.
    [self.streamManager loadThirdPartyStream:streamUrl streamSubtitles:@[]];
  }
}

- (void)adsLoader:(IMAAdsLoader *)loader failedWithErrorData:(IMAAdLoadingErrorData *)adErrorData {
  // Log the error and play the backup content.
  NSLog(@"AdsLoader error, code:%ld, message: %@", adErrorData.adError.code,
        adErrorData.adError.message);
  [self.videoPlayer play];
}

Swift

func adsLoader(_ loader: IMAAdsLoader, adsLoadedWith adsLoadedData: IMAAdsLoadedData) {
  print("DAI stream loaded. Stream session ID: \(adsLoadedData.streamManager!.streamId!)")
  streamManager = adsLoadedData.streamManager!
  streamManager!.delegate = self

  // Initialize the stream manager to handle ad click and user interactions with ad UI elements.
  streamManager!.initialize(with: nil)

  // Build the Pod serving Stream URL.
  let streamID = streamManager!.streamId
  // Your custom VTP handler takes the stream ID and returns the stream manifest URL.
  let urlString = ViewController.customVTPParser(streamID!)
  let streamUrl = URL(string: urlString)
  if ViewController.requestType == StreamType.live {
    // Live streams can be loaded directly into the AVPlayer.
    imaVideoDisplay.loadStream(streamUrl!, withSubtitles: [])
    imaVideoDisplay.play()
  } else {
    // VOD streams are loaded using the IMA SDK's stream manager.
    // The stream manager loads the stream, requests metadata, and starts playback.
    streamManager!.loadThirdPartyStream(streamUrl!, streamSubtitles: [])
  }
}

func adsLoader(_ loader: IMAAdsLoader, failedWith adErrorData: IMAAdLoadingErrorData) {
  print("Error loading DAI stream. Error message: \(adErrorData.adError.message!)")
  // Play the backup stream.
  videoPlayer.play()
}

تنفيذ معالج VTP المخصّص

يرسل معالج VTP المخصّص معرّف البث الخاص بالمشاهد إلى شريكك الفني في مجال الفيديو (VTP) مع أي معلومات أخرى يطلبها شريكك الفني في مجال الفيديو لعرض بيان بث يحتوي على كل من المحتوى والإعلانات المدمجة. يوفّر موفّر تكنولوجيا الفيديو (VTP) تعليمات محدّدة حول كيفية تنفيذ معالج VTP المخصّص.

على سبيل المثال، قد يتضمّن نموذج VTP عنوان URL لنموذج بيان يحتوي على الماكرو [[STREAMID]]. في هذا المثال، يُدرج المعالج معرّف البث بدلاً من وحدة الماكرو ويعرض عنوان URL لملف البيان الناتج.

Objective-C

/// Custom VTP Handler.
///
/// Returns the stream manifest URL from the video technical partner or manifest manipulator.
static NSString *(^gCustomVTPHandler)(NSString *) = ^(NSString *streamID) {
  // Insert synchronous code here to retrieve a stream manifest URL from your video tech partner
  // or manifest manipulation server.
  // This example uses a hardcoded URL template, containing a placeholder for the stream
  // ID and replaces the placeholder with the stream ID.
  NSString *manifestUrl = @"YOUR_MANIFEST_URL_TEMPLATE";
  return [manifestUrl stringByReplacingOccurrencesOfString:@"[[STREAMID]]"
                                                withString:streamID];
};

Swift

/// Custom VTP Handler.
///
/// Returns the stream manifest URL from the video technical partner or manifest manipulator.
static let customVTPParser = { (streamID: String) -> (String) in
  // Insert synchronous code here to retrieve a stream manifest URL from your video tech partner
  // or manifest manipulation server.
  // This example uses a hardcoded URL template, containing a placeholder for the stream
  // ID and replaces the placeholder with the stream ID.
  let manifestURL = "YOUR_MANIFEST_URL_TEMPLATE"
  return manifestURL.replacingOccurrences(of: "[[STREAMID]]", with: streamID)
}

الاستماع إلى أحداث الإعلانات

يستدعي IMAStreamManager طُرق IMAStreamManagerDelegate لتمرير أحداث البث والأخطاء إلى تطبيقك.

في هذا المثال، سجِّل أحداث الإعلانات الأساسية في وحدة التحكّم:

Objective-C

- (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdEvent:(IMAAdEvent *)event {
  NSLog(@"Ad event (%@).", event.typeString);
  switch (event.type) {
    case kIMAAdEvent_STARTED: {
      // Log extended data.
      NSString *extendedAdPodInfo = [[NSString alloc]
          initWithFormat:@"Showing ad %ld/%ld, bumper: %@, title: %@, description: %@, contentType:"
                         @"%@, pod index: %ld, time offset: %lf, max duration: %lf.",
                         (long)event.ad.adPodInfo.adPosition, (long)event.ad.adPodInfo.totalAds,
                         event.ad.adPodInfo.isBumper ? @"YES" : @"NO", event.ad.adTitle,
                         event.ad.adDescription, event.ad.contentType,
                         (long)event.ad.adPodInfo.podIndex, event.ad.adPodInfo.timeOffset,
                         event.ad.adPodInfo.maxDuration];

      NSLog(@"%@", extendedAdPodInfo);
      break;
    }
    case kIMAAdEvent_AD_BREAK_STARTED: {
      NSLog(@"Ad break started");
      break;
    }
    case kIMAAdEvent_AD_BREAK_ENDED: {
      NSLog(@"Ad break ended");
      break;
    }
    case kIMAAdEvent_AD_PERIOD_STARTED: {
      NSLog(@"Ad period started");
      break;
    }
    case kIMAAdEvent_AD_PERIOD_ENDED: {
      NSLog(@"Ad period ended");
      break;
    }
    default:
      break;
  }
}

- (void)streamManager:(IMAStreamManager *)streamManager didReceiveAdError:(IMAAdError *)error {
  NSLog(@"StreamManager error with type: %ld\ncode: %ld\nmessage: %@", error.type, error.code,
        error.message);
  [self.videoPlayer play];
}

Swift

func streamManager(_ streamManager: IMAStreamManager, didReceive event: IMAAdEvent) {
  print("Ad event \(event.typeString).")
  switch event.type {
  case IMAAdEventType.STARTED:
    // Log extended data.
    if let ad = event.ad {
      let extendedAdPodInfo = String(
        format: "Showing ad %zd/%zd, bumper: %@, title: %@, "
          + "description: %@, contentType:%@, pod index: %zd, "
          + "time offset: %lf, max duration: %lf.",
        ad.adPodInfo.adPosition,
        ad.adPodInfo.totalAds,
        ad.adPodInfo.isBumper ? "YES" : "NO",
        ad.adTitle,
        ad.adDescription,
        ad.contentType,
        ad.adPodInfo.podIndex,
        ad.adPodInfo.timeOffset,
        ad.adPodInfo.maxDuration)

      print("\(extendedAdPodInfo)")
    }
    break
  case IMAAdEventType.AD_BREAK_STARTED:
    print("Ad break started.")
    break
  case IMAAdEventType.AD_BREAK_ENDED:
    print("Ad break ended.")
    break
  case IMAAdEventType.AD_PERIOD_STARTED:
    print("Ad period started.")
    break
  case IMAAdEventType.AD_PERIOD_ENDED:
    print("Ad period ended.")
    break
  default:
    break
  }
}

func streamManager(_ streamManager: IMAStreamManager, didReceive error: IMAAdError) {
  print("StreamManager error with type: \(error.type)")
  print("code: \(error.code)")
  print("message: \(error.message ?? "Unknown Error")")
}

حذف مواد عرض IMA DAI

لإيقاف تشغيل البث وإيقاف تتبُّع جميع الإعلانات وإصدار جميع مواد عرض البث المحمَّلة، يمكنك استدعاء IMAStreamManager.destroy().

شغِّل تطبيقك. إذا نجحت العملية، اطلب بثّ "إدراج الإعلان الديناميكي" من Google وشغِّله باستخدام حزمة تطوير البرامج للإعلانات التفاعلية (IMA SDK). لمزيد من المعلومات حول ميزات حزمة تطوير البرامج (SDK) الأكثر تقدّمًا، يُرجى الاطّلاع على الأدلة الأخرى المدرَجة في الشريط الجانبي الأيمن أو النماذج على GitHub.