DAI এর জন্য IMA SDK সেট আপ করুন, DAI এর জন্য IMA SDK সেট আপ করুন, DAI এর জন্য IMA SDK সেট আপ করুন, DAI এর জন্য IMA SDK সেট আপ করুন

প্ল্যাটফর্ম নির্বাচন করুন: HTML5 Android iOS tvOS Cast Roku

আপনার পছন্দের DAI সমাধানটি নির্বাচন করুন।

পড সার্ভিং ডিএআই

IMA SDK-গুলো আপনার ওয়েবসাইট ও অ্যাপে মাল্টিমিডিয়া বিজ্ঞাপন সংহত করা সহজ করে তোলে।

IMA SDK-গুলো যেকোনো VAST-সম্মত বিজ্ঞাপন সার্ভার থেকে বিজ্ঞাপনের জন্য অনুরোধ করতে পারে এবং আপনার অ্যাপে বিজ্ঞাপনের প্লেব্যাক পরিচালনা করতে পারে।

IMA DAI SDK-এর মাধ্যমে, অ্যাপগুলো VOD বা লাইভ কন্টেন্টের জন্য বিজ্ঞাপন এবং মূল ভিডিওর স্ট্রিম অনুরোধ করে। এরপর SDK-টি একটি সম্মিলিত ভিডিও স্ট্রিম ফেরত দেয়, ফলে আপনাকে আপনার অ্যাপের মধ্যে বিজ্ঞাপন এবং মূল ভিডিওর মধ্যে পরিবর্তন পরিচালনা করতে হয় না।

এই নির্দেশিকাটি IMA DAI SDK for CAF ব্যবহার করে কীভাবে একটি DAI Pod Serving স্ট্রিম প্লে করতে হয়, তা প্রদর্শন করে।

এই নির্দেশিকাটি ব্যবহার করার আগে, Chromecast Application Framework-এর Web Receiver প্রোটোকলের সাথে পরিচিত হয়ে নিন। এই নির্দেশিকাটি ধরে নেয় যে, আপনার CAF রিসিভারের ধারণা, যেমন মেসেজ ইন্টারসেপ্টর এবং mediaInformation অবজেক্ট সম্পর্কে প্রাথমিক জ্ঞান রয়েছে এবং একটি CAF প্রেরককে অনুকরণ করার জন্য Cast Command and Control টুল ব্যবহারে আপনি পরিচিত।

IMA DAI পড সার্ভিং ব্যবহার করার জন্য, আপনাকে অবশ্যই একজন পড সার্ভিং পার্টনারের সাথে কাজ করতে হবে এবং আপনার একটি Ad Manager 360 Advanced অ্যাকাউন্ট থাকতে হবে। যদি আপনার একটি Ad Manager অ্যাকাউন্ট থাকে, তাহলে আরও বিস্তারিত জানতে আপনার অ্যাকাউন্ট ম্যানেজারের সাথে যোগাযোগ করুন। Ad Manager-এর জন্য সাইন আপ করার তথ্যের জন্য, Ad Manager হেল্প সেন্টার দেখুন।

অন্যান্য প্ল্যাটফর্মের সাথে ইন্টিগ্রেশন বা IMA ক্লায়েন্ট-সাইড SDK ব্যবহারের তথ্যের জন্য, ইন্টারেক্টিভ মিডিয়া অ্যাডস SDK দেখুন।

আইএমএ ডিএআই পড পরিবেশনের সংক্ষিপ্ত বিবরণ

IMA CAF DAI SDK ব্যবহার করে পড সার্ভিং বাস্তবায়নে দুটি প্রধান উপাদান রয়েছে, যা এই নির্দেশিকায় দেখানো হয়েছে:

  • StreamRequest : একটি অবজেক্ট যা গুগলের বিজ্ঞাপন সার্ভারগুলিতে একটি স্ট্রিম অনুরোধ নির্ধারণ করে। অনুরোধগুলিতে একটি নেটওয়ার্ক কোড, কাস্টম অ্যাসেট কী, এবং একটি ঐচ্ছিক এপিআই কী-এর পাশাপাশি অন্যান্য ঐচ্ছিক প্যারামিটারও উল্লেখ করা থাকে।
  • StreamManager : একটি অবজেক্ট যা ভিডিও স্ট্রিম এবং IMA DAI SDK-এর মধ্যে যোগাযোগ পরিচালনা করে, যেমন ট্র্যাকিং পিং পাঠানো এবং স্ট্রিম ইভেন্টগুলোকে পাবলিশারের কাছে ফরোয়ার্ড করা।

পূর্বশর্ত

  • নিবন্ধিত টেস্ট ডিভাইসসহ একটি কাস্ট ডেভেলপার কনসোল অ্যাকাউন্ট।
  • একটি হোস্টেড ওয়েব রিসিভার অ্যাপ যা আপনার কাস্ট ডেভেলপার কনসোলে নিবন্ধিত এবং যা এই নির্দেশিকায় প্রদত্ত কোড হোস্ট করার জন্য পরিবর্তন করা যেতে পারে।
  • একটি প্রেরক অ্যাপ যা আপনার ওয়েব রিসিভার অ্যাপ ব্যবহার করার জন্য কনফিগার করা হয়েছে। এই উদাহরণের জন্য, আপনার প্রেরক হিসেবে কাস্ট কমান্ড অ্যান্ড কন্ট্রোল টুলটি ব্যবহার করুন।

প্রেরকের MediaInfo অবজেক্টগুলি কনফিগার করুন

প্রথমে, আপনার প্রেরক অ্যাপের MediaInfo অবজেক্টটি নিম্নলিখিত ফিল্ডগুলি অন্তর্ভুক্ত করার জন্য কনফিগার করুন:

মাঠ বিষয়বস্তু
contentId এই মিডিয়া আইটেমটির জন্য একটি অনন্য শনাক্তকারী।

CONTENT_ID

contentUrl ঐচ্ছিক। DAI স্ট্রিম লোড হতে ব্যর্থ হলে চালানোর জন্য ব্যাকআপ স্ট্রিম URL।

BACKUP_STREAM_URL

contentType ঐচ্ছিক। কন্টেন্ট ব্যাকআপ স্ট্রিমগুলির মাইমটাইপ। শুধুমাত্র ড্যাশ স্ট্রিমগুলির জন্য প্রয়োজন।

CONTENT_STREAM_MIMETYPE

streamType এই মানের জন্য ব্যবহৃত স্ট্রিং লিটারেল বা কনস্ট্যান্ট প্রেরক প্ল্যাটফর্ম অনুযায়ী ভিন্ন হয়।
customData customData ফিল্ডটিতে অতিরিক্ত প্রয়োজনীয় ফিল্ডগুলোর একটি কী-ভ্যালু স্টোর থাকে। এই স্যাম্পলে, এতে আপনার DAI স্ট্রিম প্যারামিটারগুলো রয়েছে। একটি প্রোডাকশন অ্যাপে, আপনি এর পরিবর্তে একটি আইডেন্টিফায়ার পাস করতে পারেন, যা আপনার কাস্ট রিসিভার অ্যাপ একটি সার্ভার-সাইড রিকোয়েস্টের মাধ্যমে এই প্যারামিটারগুলো পুনরুদ্ধার করতে ব্যবহার করবে।
মাঠ বিষয়বস্তু
daiStreamType আপনার DAI স্ট্রিমের ধরন: "LIVE" অথবা "VOD" এর মধ্যে একটি।

DAI_STREAM_TYPE

networkCode আপনার গুগল অ্যাড ম্যানেজার ৩৬০ অ্যাকাউন্টের নেটওয়ার্ক কোড।

NETWORK_CODE

customAssetKey এই ফিল্ডটি শুধুমাত্র লাইভ স্ট্রিমের জন্য প্রয়োজন। কাস্টম অ্যাসেট কী, যা গুগল অ্যাড ম্যানেজার ৩৬০-এ আপনার পড সার্ভিং ইভেন্টকে শনাক্ত করে।

CUSTOM_ASSET_KEY

apiKey IMA DAI SDK থেকে একটি স্ট্রিম আইডি পুনরুদ্ধার করার জন্য একটি ঐচ্ছিক এপিআই কী।

API_KEY

আপনাকে শুরু করতে সাহায্য করার জন্য এখানে কিছু কোডের নমুনা দেওয়া হলো:

ওয়েব

একটি কাস্ট ওয়েব সেন্ডারে এই মানগুলি কনফিগার করতে, প্রথমে প্রয়োজনীয় ডেটা সহ একটি MediaInfo অবজেক্ট তৈরি করুন, তারপর ওয়েব রিসিভারে একটি লোড রিকোয়েস্ট পাঠান।

// Create mediaInfo object
const mediaInfo = new chrome.cast.media.MediaInfo("CONTENT_ID");
mediaInfo.contentUrl = "BACKUP_STREAM_URL";
mediaInfo.contentType = "CONTENT_STREAM_MIMETYPE";
mediaInfo.streamType = chrome.cast.media.StreamType.LIVE;
mediaInfo.customData = {
  daiStreamType: "DAI_STREAM_TYPE",
  networkCode: "NETWORK-CODE",
  customAssetKey: "CUSTOM_ASSET_KEY",
  apiKey: "API_KEY"
};

// Make load request to cast web receiver
const castSession = cast.framework.CastContext.getInstance().getCurrentSession();
const request = new chrome.cast.media.LoadRequest(mediaInfo);
castSession.loadMedia(request).then(
  () => { console.log('Load succeed'); },
  (errorCode) => { console.log('Error code: ' + errorCode); });

অ্যান্ড্রয়েড

একটি কাস্ট ওয়েব সেন্ডারে এই মানগুলি কনফিগার করতে, প্রথমে প্রয়োজনীয় ডেটা সহ একটি MediaInfo অবজেক্ট তৈরি করুন, তারপর ওয়েব রিসিভারে একটি লোড রিকোয়েস্ট পাঠান।

JSONObject customData = new JSONObject()?
  .put("daiStreamType", "DAI_STREAM_TYPE")
  .put("networkCode", "NETWORK-CODE")
  .put("customAssetKey", "CUSTOM_ASSET_KEY")
  .put("apiKey", "API_KEY");
MediaInfo mediaInfo = MediaInfo.Builder("CONTENT_ID")
  .setContentUrl("BACKUP_STREAM_URL")
  .setContentType("CONTENT_STREAM_MIMETYPE")
  .setStreamType(MediaInfo.STREAM_TYPE_LIVE)
  .setCustomData(customData)
  .build();

RemoteMediaClient remoteMediaClient = mCastSession.getRemoteMediaClient();
remoteMediaClient.load(new MediaLoadRequestData.Builder().setMediaInfo(mediaInfo).build());

iOS (অবজেক্ট-সি)

একটি Cast ওয়েব সেন্ডারে এই মানগুলি কনফিগার করতে, প্রথমে প্রয়োজনীয় ডেটা সহ একটি GCKMediaInformation অবজেক্ট তৈরি করুন, তারপর ওয়েব রিসিভারে একটি লোড রিকোয়েস্ট পাঠান।

NSURL url = [NSURL URLWithString:@"BACKUP_STREAM_URL"];
NSDictionary *customData = @{
  @"daiStreamType": @"DAI_STREAM_TYPE",
  @"networkCode": @"NETWORK-CODE",
  @"customAssetKey": @"CUSTOM_ASSET_KEY",
  @"apiKey": @"API_KEY"};
mediaInfoBuilder.customData = customData;

GCKMediaInformationBuilder *mediaInfoBuilder =
  [[GCKMediaInformationBuilder alloc] initWithContentID: @"CONTENT_ID"];
mediaInfoBuilder.contentURL = url;
mediaInfoBuilder.contentType = @"CONTENT_STREAM_MIMETYPE";
mediaInfoBuilder.streamType = GCKMediaStreamTypeLive;
mediaInfoBuilder.customData = customData;
self.mediaInformation = [mediaInfoBuilder build];

GCKRequest *request = [self.sessionManager.currentSession.remoteMediaClient loadMedia:self.mediaInformation];
if (request != nil) {
  request.delegate = self;
}

iOS (সুইফট)

একটি Cast ওয়েব সেন্ডারে এই মানগুলি কনফিগার করতে, প্রথমে প্রয়োজনীয় ডেটা সহ একটি GCKMediaInformation অবজেক্ট তৈরি করুন, তারপর ওয়েব রিসিভারে একটি লোড রিকোয়েস্ট পাঠান।

let url = URL.init(string: "BACKUP_STREAM_URL")
guard let mediaURL = url else {
  print("invalid mediaURL")
  return
}

let customData = [
  "daiStreamType": "DAI_STREAM_TYPE",
  "networkCode": "NETWORK-CODE",
  "customAssetKey": "CUSTOM_ASSET_KEY",
  "region": "API_KEY"
]

let mediaInfoBuilder = GCKMediaInformationBuilder.init(contentId: "CONTENT_ID")
mediaInfoBuilder.contentURL = mediaUrl
mediaInfoBuilder.contentType = @"CONTENT_STREAM_MIMETYPE"
mediaInfoBuilder.streamType = GCKMediaStreamType.Live
mediaInfoBuilder.customData = customData
mediaInformation = mediaInfoBuilder.build()

guard let mediaInfo = mediaInformation else {
  print("invalid mediaInformation")
  return
}

if let request = sessionManager.currentSession?.remoteMediaClient?.loadMedia
(mediaInfo) {
  request.delegate = self
}

সিএসি টুল

কাস্ট কমান্ড অ্যান্ড কন্ট্রোল টুলে এই মানগুলি কনফিগার করতে, লোড মিডিয়া ট্যাবে ক্লিক করুন এবং কাস্টম লোড রিকোয়েস্ট টাইপটি লোড (LOAD) এ সেট করুন। তারপর টেক্সট এরিয়ার JSON ডেটা এই JSON দিয়ে প্রতিস্থাপন করুন:

{
  "media": {
    "contentId": "CONTENT_ID",
    "contentUrl": "BACKUP_STREAM_URL",
    "contentType": ""CONTENT_STREAM_MIMETYPE"",
    "streamType": "LIVE",
    "customData": {
      "daiStreamType": "DAI_STREAM_TYPE",
      "networkCode": "NETWORK-CODE",
      "customAssetKey": "CUSTOM_ASSET_KEY",
      "oAuthToken": "API_KEY"
    }
  }
}

বাকি ধাপগুলো পরীক্ষা করার জন্য এই কাস্টম লোড রিকোয়েস্টটি রিসিভারের কাছে পাঠানো যেতে পারে।

একটি বেসিক CAF রিসিভার তৈরি করুন

CAF SDK কাস্টম ওয়েব রিসিভার গাইডে দেখানো পদ্ধতি অনুসরণ করে একটি কাস্টম ওয়েব রিসিভার তৈরি করুন।

আপনার রিসিভারের কোডটি দেখতে এইরকম হবে:

<html>
<head>
  <script
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js">
  </script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    // ...
  </script>
</body>
</html>

IMA DAI SDK ইম্পোর্ট করুন এবং প্লেয়ার ম্যানেজারটি পান।

আপনার ওয়েব রিসিভারে CAF-এর জন্য IMA DAI SDK ইম্পোর্ট করতে, CAF লোড করার স্ক্রিপ্টটির ঠিক পরেই একটি স্ক্রিপ্ট ট্যাগ যোগ করুন। রিসিভার শুরু করার আগে, স্ক্রিপ্ট ট্যাগের মধ্যে রিসিভার কনটেক্সট এবং প্লেয়ার ম্যানেজারকে কনস্ট্যান্ট হিসেবে সংরক্ষণ করুন।

<html>
<head>
  <script
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
  <script src="//imasdk.googleapis.com/js/sdkloader/cast_dai.js"></script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();

    castContext.start();
  </script>
</body>
</html>

আইএমএ স্ট্রিম ম্যানেজার শুরু করুন

আইএমএ স্ট্রিম ম্যানেজার চালু করুন।

<html>
<head>
  <script type="text/javascript"
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
  <script src="//imasdk.googleapis.com/js/sdkloader/cast_dai.js"></script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();
    const streamManager = new google.ima.cast.dai.api.StreamManager();

    castContext.start();
  </script>
</body>
</html>

স্ট্রিম ম্যানেজার লোড ইন্টারসেপ্টর তৈরি করুন

আপনার মিডিয়া আইটেমগুলো CAF-এ পাঠানোর আগে, একটি LOAD মেসেজ ইন্টারসেপ্টরে আপনার স্ট্রিম রিকোয়েস্ট তৈরি করুন।

    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();
    const streamManager = new google.ima.cast.dai.api.StreamManager();

    /**
     * Creates a livestream request object for a Pod Serving stream.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {StreamRequest} an IMA stream request
     */
    const createStreamRequest = (castRequest) => { /* ... */};

    /**
     * Initates a DAI stream request for the final stream manifest.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {Promise<LoadRequestData>} a promise that resolves to an updated castRequest, containing the DAI stream manifest
     */
    const createDAICastRequest = (castRequest) => {
        return streamManager.requestStream(castRequest, createStreamRequest(castRequest))
          .then((castRequestWithPodStreamData) => {
            console.log('Successfully made DAI stream request.');
            // ...
            return castRequestWithPodStreamData;
          })
          .catch((error) => {
            console.log('Failed to make DAI stream request.');
            // CAF will automatically fallback to the content URL
            // that it can read from the castRequest object.
            return castRequest;
          });
    };

    playerManager.setMessageInterceptor(
        cast.framework.messages.MessageType.LOAD, createDAICastRequest);

    castContext.start();

স্ট্রিম অনুরোধ তৈরি করুন

CAF লোড অনুরোধের উপর ভিত্তি করে একটি পড সার্ভিং স্ট্রিম তৈরি করতে createStreamRequest ফাংশনটি সম্পূর্ণ করুন।

    /**
     * Creates a livestream request object for a Pod Serving stream.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {StreamRequest} an IMA stream request
     */
    const createStreamRequest = (castRequest) => {
      const customData = castRequest.media.customData;
      let streamRequest;
      if (customData.daiStreamType == "LIVE") {
        streamRequest = new google.ima.cast.dai.api.PodStreamRequest();
        streamRequest.customAssetKey = customData.customAssetKey;
        streamRequest.networkCode = customData.networkCode;
        streamRequest.apiKey = customData.apiKey;
      } else if (customData.daiStreamType == "VOD") {
        streamRequest = new google.ima.cast.dai.api.PodVodStreamRequest();
        streamRequest.networkCode = customData.networkCode;
        streamRequest.apiKey = customData.apiKey;
      }
      return streamRequest;
    };

আপনার VTP থেকে সেলাই করা ম্যানিফেস্টটি পুনরুদ্ধার করুন।

আপনার স্ট্রিম অনুরোধ সফল হলে, স্ট্রিমের আইডি পেতে streamManager.getStreamId() ব্যবহার করুন। আপনার ভিডিও টেকনিক্যাল পার্টনার (VTP) বা কাস্টম ম্যানিফেস্ট ম্যানিপুলেটর এই স্ট্রিম আইডি ব্যবহার করে একটি ম্যানিফেস্ট URL পাওয়ার জন্য নির্দেশনা প্রদান করবে।

একবার আপনার ম্যানিফেস্ট URL পেয়ে গেলে, বিদ্যমান contentUrl নতুন manifestUrl দিয়ে প্রতিস্থাপন করুন।

সবশেষে, পরিবর্তিত স্ট্রিম ম্যানিফেস্টটি ফেরত দেওয়ার আগে, আপনার streamManager ` loadStreamMetadata মেথডটি কল করুন, যাতে IMA SDK জানতে পারে যে এটি নিরাপদে স্ট্রিম মেটাডেটার জন্য অনুরোধ করতে পারে। এই কলটি শুধুমাত্র VOD স্ট্রিমের জন্য প্রয়োজন।

    /**
     * Initates a DAI stream request for the final stream manifest.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {Promise<LoadRequestData>} a promise that resolves to an updated castRequest, containing the DAI stream manifest
     */
    const createDAICastRequest = (castRequest) => {
        return streamManager.requestStream(castRequest, createStreamRequest(castRequest))
          .then((castRequestWithPodStreamData) => {
            console.log('Successfully made DAI stream request.');

            // This is a sample VTP integration. Consult your VTP documentation
            // for how to retrieve an ad-stitched stream manifest URL.
            const manifestTemplate = "https://.../manifest.m3u8?gam_stream_id=[[STREAMID]]";
            const streamId = streamManager.getStreamId();
            const manifestUrl = manifestTemplate.replace('[[STREAMID]]', streamId)
            // Assign your manifestUrl to the request's content URL.
            castRequestWithPodStreamData.media.contentUrl = manifestUrl;

            // After generating the manifest URL, VOD streams must notify the
            // IMA SDK that it is safe to request ad pod metadata.
            // This is only necessary for VOD streams. It is a no-op for
            // livestreams, so no conditional is needed.
            streamManager.loadStreamMetadata();

            return castRequestWithPodStreamData;
          })
          .catch((error) => {
            console.log('Failed to make DAI stream request.');
            // CAF will automatically fallback to the content URL
            // that it can read from the castRequest object.
            return castRequest;
          });
    };

IMA DAI সম্পদ পরিষ্কার করুন

IMA DAI SDK ব্যবহার করে একটি পড সার্ভিং স্ট্রিমে বিজ্ঞাপন অনুরোধ করা এবং প্রদর্শন করা সফলভাবে শেষ করার পর, আমরা পরামর্শ দিই যে পড সার্ভিং সেশনটি সম্পূর্ণ হলে আপনি সমস্ত রিসোর্স পরিষ্কার করে ফেলুন। স্ট্রিম প্লেব্যাক বন্ধ করতে, সমস্ত বিজ্ঞাপন ট্র্যাকিং বন্ধ করতে এবং লোড হওয়া সমস্ত স্ট্রিম অ্যাসেট মুক্ত করতে StreamManager.destroy() কল করুন।

,
প্ল্যাটফর্ম নির্বাচন করুন: HTML5 Android iOS tvOS Cast Roku

আপনার পছন্দের DAI সমাধানটি নির্বাচন করুন।

পড সার্ভিং ডিএআই

IMA SDK-গুলো আপনার ওয়েবসাইট ও অ্যাপে মাল্টিমিডিয়া বিজ্ঞাপন সংহত করা সহজ করে তোলে।

IMA SDK-গুলো যেকোনো VAST-সম্মত বিজ্ঞাপন সার্ভার থেকে বিজ্ঞাপনের জন্য অনুরোধ করতে পারে এবং আপনার অ্যাপে বিজ্ঞাপনের প্লেব্যাক পরিচালনা করতে পারে।

IMA DAI SDK-এর মাধ্যমে, অ্যাপগুলো VOD বা লাইভ কন্টেন্টের জন্য বিজ্ঞাপন এবং মূল ভিডিওর স্ট্রিম অনুরোধ করে। এরপর SDK-টি একটি সম্মিলিত ভিডিও স্ট্রিম ফেরত দেয়, ফলে আপনাকে আপনার অ্যাপের মধ্যে বিজ্ঞাপন এবং মূল ভিডিওর মধ্যে পরিবর্তন পরিচালনা করতে হয় না।

এই নির্দেশিকাটি IMA DAI SDK for CAF ব্যবহার করে কীভাবে একটি DAI Pod Serving স্ট্রিম প্লে করতে হয়, তা প্রদর্শন করে।

এই নির্দেশিকাটি ব্যবহার করার আগে, Chromecast Application Framework-এর Web Receiver প্রোটোকলের সাথে পরিচিত হয়ে নিন। এই নির্দেশিকাটি ধরে নেয় যে, আপনার CAF রিসিভারের ধারণা, যেমন মেসেজ ইন্টারসেপ্টর এবং mediaInformation অবজেক্ট সম্পর্কে প্রাথমিক জ্ঞান রয়েছে এবং একটি CAF প্রেরককে অনুকরণ করার জন্য Cast Command and Control টুল ব্যবহারে আপনি পরিচিত।

IMA DAI পড সার্ভিং ব্যবহার করার জন্য, আপনাকে অবশ্যই একজন পড সার্ভিং পার্টনারের সাথে কাজ করতে হবে এবং আপনার একটি Ad Manager 360 Advanced অ্যাকাউন্ট থাকতে হবে। যদি আপনার একটি Ad Manager অ্যাকাউন্ট থাকে, তাহলে আরও বিস্তারিত জানতে আপনার অ্যাকাউন্ট ম্যানেজারের সাথে যোগাযোগ করুন। Ad Manager-এর জন্য সাইন আপ করার তথ্যের জন্য, Ad Manager হেল্প সেন্টার দেখুন।

অন্যান্য প্ল্যাটফর্মের সাথে ইন্টিগ্রেশন বা IMA ক্লায়েন্ট-সাইড SDK ব্যবহারের তথ্যের জন্য, ইন্টারেক্টিভ মিডিয়া অ্যাডস SDK দেখুন।

আইএমএ ডিএআই পড পরিবেশনের সংক্ষিপ্ত বিবরণ

IMA CAF DAI SDK ব্যবহার করে পড সার্ভিং বাস্তবায়নে দুটি প্রধান উপাদান রয়েছে, যা এই নির্দেশিকায় দেখানো হয়েছে:

  • StreamRequest : একটি অবজেক্ট যা গুগলের বিজ্ঞাপন সার্ভারগুলিতে একটি স্ট্রিম অনুরোধ নির্ধারণ করে। অনুরোধগুলিতে একটি নেটওয়ার্ক কোড, কাস্টম অ্যাসেট কী, এবং একটি ঐচ্ছিক এপিআই কী-এর পাশাপাশি অন্যান্য ঐচ্ছিক প্যারামিটারও উল্লেখ করা থাকে।
  • StreamManager : একটি অবজেক্ট যা ভিডিও স্ট্রিম এবং IMA DAI SDK-এর মধ্যে যোগাযোগ পরিচালনা করে, যেমন ট্র্যাকিং পিং পাঠানো এবং স্ট্রিম ইভেন্টগুলোকে পাবলিশারের কাছে ফরোয়ার্ড করা।

পূর্বশর্ত

  • নিবন্ধিত টেস্ট ডিভাইসসহ একটি কাস্ট ডেভেলপার কনসোল অ্যাকাউন্ট।
  • একটি হোস্টেড ওয়েব রিসিভার অ্যাপ যা আপনার কাস্ট ডেভেলপার কনসোলে নিবন্ধিত এবং যা এই নির্দেশিকায় প্রদত্ত কোড হোস্ট করার জন্য পরিবর্তন করা যেতে পারে।
  • একটি প্রেরক অ্যাপ যা আপনার ওয়েব রিসিভার অ্যাপ ব্যবহার করার জন্য কনফিগার করা হয়েছে। এই উদাহরণের জন্য, আপনার প্রেরক হিসেবে কাস্ট কমান্ড অ্যান্ড কন্ট্রোল টুলটি ব্যবহার করুন।

প্রেরকের MediaInfo অবজেক্টগুলি কনফিগার করুন

প্রথমে, আপনার প্রেরক অ্যাপের MediaInfo অবজেক্টটি নিম্নলিখিত ফিল্ডগুলি অন্তর্ভুক্ত করার জন্য কনফিগার করুন:

মাঠ বিষয়বস্তু
contentId এই মিডিয়া আইটেমটির জন্য একটি অনন্য শনাক্তকারী।

CONTENT_ID

contentUrl ঐচ্ছিক। DAI স্ট্রিম লোড হতে ব্যর্থ হলে চালানোর জন্য ব্যাকআপ স্ট্রিম URL।

BACKUP_STREAM_URL

contentType ঐচ্ছিক। কন্টেন্ট ব্যাকআপ স্ট্রিমগুলির মাইমটাইপ। শুধুমাত্র ড্যাশ স্ট্রিমগুলির জন্য প্রয়োজন।

CONTENT_STREAM_MIMETYPE

streamType এই মানের জন্য ব্যবহৃত স্ট্রিং লিটারেল বা কনস্ট্যান্ট প্রেরক প্ল্যাটফর্ম অনুযায়ী ভিন্ন হয়।
customData customData ফিল্ডটিতে অতিরিক্ত প্রয়োজনীয় ফিল্ডগুলোর একটি কী-ভ্যালু স্টোর থাকে। এই স্যাম্পলে, এতে আপনার DAI স্ট্রিম প্যারামিটারগুলো রয়েছে। একটি প্রোডাকশন অ্যাপে, আপনি এর পরিবর্তে একটি আইডেন্টিফায়ার পাস করতে পারেন, যা আপনার কাস্ট রিসিভার অ্যাপ একটি সার্ভার-সাইড রিকোয়েস্টের মাধ্যমে এই প্যারামিটারগুলো পুনরুদ্ধার করতে ব্যবহার করবে।
মাঠ বিষয়বস্তু
daiStreamType আপনার DAI স্ট্রিমের ধরন: "LIVE" অথবা "VOD" এর মধ্যে একটি।

DAI_STREAM_TYPE

networkCode আপনার গুগল অ্যাড ম্যানেজার ৩৬০ অ্যাকাউন্টের নেটওয়ার্ক কোড।

NETWORK_CODE

customAssetKey এই ফিল্ডটি শুধুমাত্র লাইভ স্ট্রিমের জন্য প্রয়োজন। কাস্টম অ্যাসেট কী, যা গুগল অ্যাড ম্যানেজার ৩৬০-এ আপনার পড সার্ভিং ইভেন্টকে শনাক্ত করে।

CUSTOM_ASSET_KEY

apiKey IMA DAI SDK থেকে একটি স্ট্রিম আইডি পুনরুদ্ধার করার জন্য একটি ঐচ্ছিক এপিআই কী।

API_KEY

আপনাকে শুরু করতে সাহায্য করার জন্য এখানে কিছু কোডের নমুনা দেওয়া হলো:

ওয়েব

একটি কাস্ট ওয়েব সেন্ডারে এই মানগুলি কনফিগার করতে, প্রথমে প্রয়োজনীয় ডেটা সহ একটি MediaInfo অবজেক্ট তৈরি করুন, তারপর ওয়েব রিসিভারে একটি লোড রিকোয়েস্ট পাঠান।

// Create mediaInfo object
const mediaInfo = new chrome.cast.media.MediaInfo("CONTENT_ID");
mediaInfo.contentUrl = "BACKUP_STREAM_URL";
mediaInfo.contentType = "CONTENT_STREAM_MIMETYPE";
mediaInfo.streamType = chrome.cast.media.StreamType.LIVE;
mediaInfo.customData = {
  daiStreamType: "DAI_STREAM_TYPE",
  networkCode: "NETWORK-CODE",
  customAssetKey: "CUSTOM_ASSET_KEY",
  apiKey: "API_KEY"
};

// Make load request to cast web receiver
const castSession = cast.framework.CastContext.getInstance().getCurrentSession();
const request = new chrome.cast.media.LoadRequest(mediaInfo);
castSession.loadMedia(request).then(
  () => { console.log('Load succeed'); },
  (errorCode) => { console.log('Error code: ' + errorCode); });

অ্যান্ড্রয়েড

একটি কাস্ট ওয়েব সেন্ডারে এই মানগুলি কনফিগার করতে, প্রথমে প্রয়োজনীয় ডেটা সহ একটি MediaInfo অবজেক্ট তৈরি করুন, তারপর ওয়েব রিসিভারে একটি লোড রিকোয়েস্ট পাঠান।

JSONObject customData = new JSONObject()?
  .put("daiStreamType", "DAI_STREAM_TYPE")
  .put("networkCode", "NETWORK-CODE")
  .put("customAssetKey", "CUSTOM_ASSET_KEY")
  .put("apiKey", "API_KEY");
MediaInfo mediaInfo = MediaInfo.Builder("CONTENT_ID")
  .setContentUrl("BACKUP_STREAM_URL")
  .setContentType("CONTENT_STREAM_MIMETYPE")
  .setStreamType(MediaInfo.STREAM_TYPE_LIVE)
  .setCustomData(customData)
  .build();

RemoteMediaClient remoteMediaClient = mCastSession.getRemoteMediaClient();
remoteMediaClient.load(new MediaLoadRequestData.Builder().setMediaInfo(mediaInfo).build());

iOS (অবজেক্ট-সি)

একটি Cast ওয়েব সেন্ডারে এই মানগুলি কনফিগার করতে, প্রথমে প্রয়োজনীয় ডেটা সহ একটি GCKMediaInformation অবজেক্ট তৈরি করুন, তারপর ওয়েব রিসিভারে একটি লোড রিকোয়েস্ট পাঠান।

NSURL url = [NSURL URLWithString:@"BACKUP_STREAM_URL"];
NSDictionary *customData = @{
  @"daiStreamType": @"DAI_STREAM_TYPE",
  @"networkCode": @"NETWORK-CODE",
  @"customAssetKey": @"CUSTOM_ASSET_KEY",
  @"apiKey": @"API_KEY"};
mediaInfoBuilder.customData = customData;

GCKMediaInformationBuilder *mediaInfoBuilder =
  [[GCKMediaInformationBuilder alloc] initWithContentID: @"CONTENT_ID"];
mediaInfoBuilder.contentURL = url;
mediaInfoBuilder.contentType = @"CONTENT_STREAM_MIMETYPE";
mediaInfoBuilder.streamType = GCKMediaStreamTypeLive;
mediaInfoBuilder.customData = customData;
self.mediaInformation = [mediaInfoBuilder build];

GCKRequest *request = [self.sessionManager.currentSession.remoteMediaClient loadMedia:self.mediaInformation];
if (request != nil) {
  request.delegate = self;
}

iOS (সুইফট)

একটি Cast ওয়েব সেন্ডারে এই মানগুলি কনফিগার করতে, প্রথমে প্রয়োজনীয় ডেটা সহ একটি GCKMediaInformation অবজেক্ট তৈরি করুন, তারপর ওয়েব রিসিভারে একটি লোড রিকোয়েস্ট পাঠান।

let url = URL.init(string: "BACKUP_STREAM_URL")
guard let mediaURL = url else {
  print("invalid mediaURL")
  return
}

let customData = [
  "daiStreamType": "DAI_STREAM_TYPE",
  "networkCode": "NETWORK-CODE",
  "customAssetKey": "CUSTOM_ASSET_KEY",
  "region": "API_KEY"
]

let mediaInfoBuilder = GCKMediaInformationBuilder.init(contentId: "CONTENT_ID")
mediaInfoBuilder.contentURL = mediaUrl
mediaInfoBuilder.contentType = @"CONTENT_STREAM_MIMETYPE"
mediaInfoBuilder.streamType = GCKMediaStreamType.Live
mediaInfoBuilder.customData = customData
mediaInformation = mediaInfoBuilder.build()

guard let mediaInfo = mediaInformation else {
  print("invalid mediaInformation")
  return
}

if let request = sessionManager.currentSession?.remoteMediaClient?.loadMedia
(mediaInfo) {
  request.delegate = self
}

সিএসি টুল

কাস্ট কমান্ড অ্যান্ড কন্ট্রোল টুলে এই মানগুলি কনফিগার করতে, লোড মিডিয়া ট্যাবে ক্লিক করুন এবং কাস্টম লোড রিকোয়েস্ট টাইপটি লোড (LOAD) এ সেট করুন। তারপর টেক্সট এরিয়ার JSON ডেটা এই JSON দিয়ে প্রতিস্থাপন করুন:

{
  "media": {
    "contentId": "CONTENT_ID",
    "contentUrl": "BACKUP_STREAM_URL",
    "contentType": ""CONTENT_STREAM_MIMETYPE"",
    "streamType": "LIVE",
    "customData": {
      "daiStreamType": "DAI_STREAM_TYPE",
      "networkCode": "NETWORK-CODE",
      "customAssetKey": "CUSTOM_ASSET_KEY",
      "oAuthToken": "API_KEY"
    }
  }
}

বাকি ধাপগুলো পরীক্ষা করার জন্য এই কাস্টম লোড রিকোয়েস্টটি রিসিভারের কাছে পাঠানো যেতে পারে।

একটি বেসিক CAF রিসিভার তৈরি করুন

CAF SDK কাস্টম ওয়েব রিসিভার গাইডে দেখানো পদ্ধতি অনুসরণ করে একটি কাস্টম ওয়েব রিসিভার তৈরি করুন।

আপনার রিসিভারের কোডটি দেখতে এইরকম হবে:

<html>
<head>
  <script
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js">
  </script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    // ...
  </script>
</body>
</html>

IMA DAI SDK ইম্পোর্ট করুন এবং প্লেয়ার ম্যানেজারটি পান।

আপনার ওয়েব রিসিভারে CAF-এর জন্য IMA DAI SDK ইম্পোর্ট করতে, CAF লোড করার স্ক্রিপ্টটির ঠিক পরেই একটি স্ক্রিপ্ট ট্যাগ যোগ করুন। রিসিভার শুরু করার আগে, স্ক্রিপ্ট ট্যাগের মধ্যে রিসিভার কনটেক্সট এবং প্লেয়ার ম্যানেজারকে কনস্ট্যান্ট হিসেবে সংরক্ষণ করুন।

<html>
<head>
  <script
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
  <script src="//imasdk.googleapis.com/js/sdkloader/cast_dai.js"></script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();

    castContext.start();
  </script>
</body>
</html>

আইএমএ স্ট্রিম ম্যানেজার শুরু করুন

আইএমএ স্ট্রিম ম্যানেজার চালু করুন।

<html>
<head>
  <script type="text/javascript"
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
  <script src="//imasdk.googleapis.com/js/sdkloader/cast_dai.js"></script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();
    const streamManager = new google.ima.cast.dai.api.StreamManager();

    castContext.start();
  </script>
</body>
</html>

স্ট্রিম ম্যানেজার লোড ইন্টারসেপ্টর তৈরি করুন

আপনার মিডিয়া আইটেমগুলো CAF-এ পাঠানোর আগে, একটি LOAD মেসেজ ইন্টারসেপ্টরে আপনার স্ট্রিম রিকোয়েস্ট তৈরি করুন।

    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();
    const streamManager = new google.ima.cast.dai.api.StreamManager();

    /**
     * Creates a livestream request object for a Pod Serving stream.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {StreamRequest} an IMA stream request
     */
    const createStreamRequest = (castRequest) => { /* ... */};

    /**
     * Initates a DAI stream request for the final stream manifest.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {Promise<LoadRequestData>} a promise that resolves to an updated castRequest, containing the DAI stream manifest
     */
    const createDAICastRequest = (castRequest) => {
        return streamManager.requestStream(castRequest, createStreamRequest(castRequest))
          .then((castRequestWithPodStreamData) => {
            console.log('Successfully made DAI stream request.');
            // ...
            return castRequestWithPodStreamData;
          })
          .catch((error) => {
            console.log('Failed to make DAI stream request.');
            // CAF will automatically fallback to the content URL
            // that it can read from the castRequest object.
            return castRequest;
          });
    };

    playerManager.setMessageInterceptor(
        cast.framework.messages.MessageType.LOAD, createDAICastRequest);

    castContext.start();

স্ট্রিম অনুরোধ তৈরি করুন

CAF লোড অনুরোধের উপর ভিত্তি করে একটি পড সার্ভিং স্ট্রিম তৈরি করতে createStreamRequest ফাংশনটি সম্পূর্ণ করুন।

    /**
     * Creates a livestream request object for a Pod Serving stream.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {StreamRequest} an IMA stream request
     */
    const createStreamRequest = (castRequest) => {
      const customData = castRequest.media.customData;
      let streamRequest;
      if (customData.daiStreamType == "LIVE") {
        streamRequest = new google.ima.cast.dai.api.PodStreamRequest();
        streamRequest.customAssetKey = customData.customAssetKey;
        streamRequest.networkCode = customData.networkCode;
        streamRequest.apiKey = customData.apiKey;
      } else if (customData.daiStreamType == "VOD") {
        streamRequest = new google.ima.cast.dai.api.PodVodStreamRequest();
        streamRequest.networkCode = customData.networkCode;
        streamRequest.apiKey = customData.apiKey;
      }
      return streamRequest;
    };

আপনার VTP থেকে সেলাই করা ম্যানিফেস্টটি পুনরুদ্ধার করুন।

আপনার স্ট্রিম অনুরোধ সফল হলে, স্ট্রিমের আইডি পেতে streamManager.getStreamId() ব্যবহার করুন। আপনার ভিডিও টেকনিক্যাল পার্টনার (VTP) বা কাস্টম ম্যানিফেস্ট ম্যানিপুলেটর এই স্ট্রিম আইডি ব্যবহার করে একটি ম্যানিফেস্ট URL পাওয়ার জন্য নির্দেশনা প্রদান করবে।

একবার আপনার ম্যানিফেস্ট URL পেয়ে গেলে, বিদ্যমান contentUrl নতুন manifestUrl দিয়ে প্রতিস্থাপন করুন।

সবশেষে, পরিবর্তিত স্ট্রিম ম্যানিফেস্টটি ফেরত দেওয়ার আগে, আপনার streamManager ` loadStreamMetadata মেথডটি কল করুন, যাতে IMA SDK জানতে পারে যে এটি নিরাপদে স্ট্রিম মেটাডেটার জন্য অনুরোধ করতে পারে। এই কলটি শুধুমাত্র VOD স্ট্রিমের জন্য প্রয়োজন।

    /**
     * Initates a DAI stream request for the final stream manifest.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {Promise<LoadRequestData>} a promise that resolves to an updated castRequest, containing the DAI stream manifest
     */
    const createDAICastRequest = (castRequest) => {
        return streamManager.requestStream(castRequest, createStreamRequest(castRequest))
          .then((castRequestWithPodStreamData) => {
            console.log('Successfully made DAI stream request.');

            // This is a sample VTP integration. Consult your VTP documentation
            // for how to retrieve an ad-stitched stream manifest URL.
            const manifestTemplate = "https://.../manifest.m3u8?gam_stream_id=[[STREAMID]]";
            const streamId = streamManager.getStreamId();
            const manifestUrl = manifestTemplate.replace('[[STREAMID]]', streamId)
            // Assign your manifestUrl to the request's content URL.
            castRequestWithPodStreamData.media.contentUrl = manifestUrl;

            // After generating the manifest URL, VOD streams must notify the
            // IMA SDK that it is safe to request ad pod metadata.
            // This is only necessary for VOD streams. It is a no-op for
            // livestreams, so no conditional is needed.
            streamManager.loadStreamMetadata();

            return castRequestWithPodStreamData;
          })
          .catch((error) => {
            console.log('Failed to make DAI stream request.');
            // CAF will automatically fallback to the content URL
            // that it can read from the castRequest object.
            return castRequest;
          });
    };

IMA DAI সম্পদ পরিষ্কার করুন

IMA DAI SDK ব্যবহার করে একটি পড সার্ভিং স্ট্রিমে বিজ্ঞাপন অনুরোধ করা এবং প্রদর্শন করা সফলভাবে শেষ করার পর, আমরা পরামর্শ দিই যে পড সার্ভিং সেশনটি সম্পূর্ণ হলে আপনি সমস্ত রিসোর্স পরিষ্কার করে ফেলুন। স্ট্রিম প্লেব্যাক বন্ধ করতে, সমস্ত বিজ্ঞাপন ট্র্যাকিং বন্ধ করতে এবং লোড হওয়া সমস্ত স্ট্রিম অ্যাসেট মুক্ত করতে StreamManager.destroy() কল করুন।

,
প্ল্যাটফর্ম নির্বাচন করুন: HTML5 Android iOS tvOS Cast Roku

আপনার পছন্দের DAI সমাধানটি নির্বাচন করুন।

পড সার্ভিং ডিএআই

IMA SDKs simplify integrating multimedia ads into your websites and apps.

IMA SDKs can request ads from any VAST-compliant ad server and manage ad playback in your apps.

With IMA DAI SDKs, apps make a stream request for ad and content video for either VOD or live content. The SDK then returns a combined video stream, so that you don't have to manage switching between ad and content video within your app.

This guide demonstrates how to play a DAI Pod Serving stream, using the IMA DAI SDK for CAF.

Before using this guide, familiarize yourself with the Chromecast Application Framework's Web Receiver protocol. This guide assumes a basic understanding of CAF receiver concepts, such as message interceptors and mediaInformation objects, and familiarity with using the Cast Command and Control tool , to emulate a CAF sender.

To use IMA DAI Pod Serving, you must be working with a Pod Serving partner and must have an Ad Manager 360 Advanced account. If you have an Ad Manager account, contact your account manager for more details. For information about signing up for Ad Manager, visit the Ad Manager Help Center .

For information on integrating with other platforms, or on using the IMA client-side SDKs, see Interactive Media Ads SDKs .

IMA DAI Pod Serving overview

Implementing Pod Serving using the IMA CAF DAI SDK involves two main components, which are demonstrated in this guide:

  • StreamRequest : An object that defines a stream request to Google's advertising servers. Requests specify a Network Code, Custom Asset Key, and an optional API key, as well as other optional parameters.
  • StreamManager : একটি অবজেক্ট যা ভিডিও স্ট্রিম এবং IMA DAI SDK-এর মধ্যে যোগাযোগ পরিচালনা করে, যেমন ট্র্যাকিং পিং পাঠানো এবং স্ট্রিম ইভেন্টগুলোকে পাবলিশারের কাছে ফরোয়ার্ড করা।

পূর্বশর্ত

  • A Cast Developer Console account with registered test devices.
  • A hosted web receiver app that is registered with your Cast Developer Console and which can be modified to host the code provided by this guide.
  • A sending app that is configured to use your web receiver app. For the purposes of this example, use the Cast Command and Control tool as your sender.

Configure the sender's MediaInfo objects

First, configure your sender app's MediaInfo object to include the following fields:

মাঠ বিষয়বস্তু
contentId A unique identifier for this media item.

CONTENT_ID

contentUrl Optional. Backup stream URL to play if the DAI stream fails to load.

BACKUP_STREAM_URL

contentType Optional. Mimetype of the content backup streams. Only needed for DASH streams .

CONTENT_STREAM_MIMETYPE

streamType The string literal or constant used for this value varies by sender platform.
customData The customData field contains a key-value store of additional required fields. In this sample, it contains your DAI stream parameters. In a production app you might instead pass an identifier that your cast receiver app would use to retrieve these parameters with a server-side request.
মাঠ বিষয়বস্তু
daiStreamType The type of your DAI stream. one of either "LIVE" or "VOD"

DAI_STREAM_TYPE

networkCode The network code for your Google Ad Manager 360 account.

NETWORK_CODE

customAssetKey This field is needed for Live streams only. The custom asset key that identifies your Pod Serving event in Google Ad Manager 360.

CUSTOM_ASSET_KEY

apiKey An optional API key to retrieve a Stream ID from the IMA DAI SDK.

API_KEY

Here are some code samples to help you get started:

ওয়েব

To configure these values in a Cast web sender, first create a MediaInfo object with the required data, then make a load request to the web receiver.

// Create mediaInfo object
const mediaInfo = new chrome.cast.media.MediaInfo("CONTENT_ID");
mediaInfo.contentUrl = "BACKUP_STREAM_URL";
mediaInfo.contentType = "CONTENT_STREAM_MIMETYPE";
mediaInfo.streamType = chrome.cast.media.StreamType.LIVE;
mediaInfo.customData = {
  daiStreamType: "DAI_STREAM_TYPE",
  networkCode: "NETWORK-CODE",
  customAssetKey: "CUSTOM_ASSET_KEY",
  apiKey: "API_KEY"
};

// Make load request to cast web receiver
const castSession = cast.framework.CastContext.getInstance().getCurrentSession();
const request = new chrome.cast.media.LoadRequest(mediaInfo);
castSession.loadMedia(request).then(
  () => { console.log('Load succeed'); },
  (errorCode) => { console.log('Error code: ' + errorCode); });

অ্যান্ড্রয়েড

To configure these values in a Cast web sender, first create a MediaInfo object with the required data, then make a load request to the web receiver.

JSONObject customData = new JSONObject()?
  .put("daiStreamType", "DAI_STREAM_TYPE")
  .put("networkCode", "NETWORK-CODE")
  .put("customAssetKey", "CUSTOM_ASSET_KEY")
  .put("apiKey", "API_KEY");
MediaInfo mediaInfo = MediaInfo.Builder("CONTENT_ID")
  .setContentUrl("BACKUP_STREAM_URL")
  .setContentType("CONTENT_STREAM_MIMETYPE")
  .setStreamType(MediaInfo.STREAM_TYPE_LIVE)
  .setCustomData(customData)
  .build();

RemoteMediaClient remoteMediaClient = mCastSession.getRemoteMediaClient();
remoteMediaClient.load(new MediaLoadRequestData.Builder().setMediaInfo(mediaInfo).build());

iOS (Obj-C)

To configure these values in a Cast web sender, first create a GCKMediaInformation object with the required data, then make a load request to the web receiver.

NSURL url = [NSURL URLWithString:@"BACKUP_STREAM_URL"];
NSDictionary *customData = @{
  @"daiStreamType": @"DAI_STREAM_TYPE",
  @"networkCode": @"NETWORK-CODE",
  @"customAssetKey": @"CUSTOM_ASSET_KEY",
  @"apiKey": @"API_KEY"};
mediaInfoBuilder.customData = customData;

GCKMediaInformationBuilder *mediaInfoBuilder =
  [[GCKMediaInformationBuilder alloc] initWithContentID: @"CONTENT_ID"];
mediaInfoBuilder.contentURL = url;
mediaInfoBuilder.contentType = @"CONTENT_STREAM_MIMETYPE";
mediaInfoBuilder.streamType = GCKMediaStreamTypeLive;
mediaInfoBuilder.customData = customData;
self.mediaInformation = [mediaInfoBuilder build];

GCKRequest *request = [self.sessionManager.currentSession.remoteMediaClient loadMedia:self.mediaInformation];
if (request != nil) {
  request.delegate = self;
}

iOS (Swift)

To configure these values in a Cast web sender, first create a GCKMediaInformation object with the required data, then make a load request to the web receiver.

let url = URL.init(string: "BACKUP_STREAM_URL")
guard let mediaURL = url else {
  print("invalid mediaURL")
  return
}

let customData = [
  "daiStreamType": "DAI_STREAM_TYPE",
  "networkCode": "NETWORK-CODE",
  "customAssetKey": "CUSTOM_ASSET_KEY",
  "region": "API_KEY"
]

let mediaInfoBuilder = GCKMediaInformationBuilder.init(contentId: "CONTENT_ID")
mediaInfoBuilder.contentURL = mediaUrl
mediaInfoBuilder.contentType = @"CONTENT_STREAM_MIMETYPE"
mediaInfoBuilder.streamType = GCKMediaStreamType.Live
mediaInfoBuilder.customData = customData
mediaInformation = mediaInfoBuilder.build()

guard let mediaInfo = mediaInformation else {
  print("invalid mediaInformation")
  return
}

if let request = sessionManager.currentSession?.remoteMediaClient?.loadMedia
(mediaInfo) {
  request.delegate = self
}

CAC tool

To configure these values in the Cast Command and Control tool , click the Load Media tab, and set the custom load request type to LOAD. Then replace the JSON data in the text area with this JSON:

{
  "media": {
    "contentId": "CONTENT_ID",
    "contentUrl": "BACKUP_STREAM_URL",
    "contentType": ""CONTENT_STREAM_MIMETYPE"",
    "streamType": "LIVE",
    "customData": {
      "daiStreamType": "DAI_STREAM_TYPE",
      "networkCode": "NETWORK-CODE",
      "customAssetKey": "CUSTOM_ASSET_KEY",
      "oAuthToken": "API_KEY"
    }
  }
}

This custom load request can be sent to the receiver to test the rest of the steps.

Create a basic CAF receiver

Create a custom web receiver, as seen in the CAF SDK Custom Web Receiver Guide .

Your receiver's code should look like this:

<html>
<head>
  <script
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js">
  </script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    // ...
  </script>
</body>
</html>

Import the IMA DAI SDK and get the Player Manager

Add a script tag to import the IMA DAI SDK for CAF to your web receiver, just after the script loading CAF. In the script tag, store the receiver context and player manager as constants before starting the receiver.

<html>
<head>
  <script
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
  <script src="//imasdk.googleapis.com/js/sdkloader/cast_dai.js"></script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();

    castContext.start();
  </script>
</body>
</html>

Initialize the IMA Stream Manager

Initialize the IMA Stream Manager.

<html>
<head>
  <script type="text/javascript"
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
  <script src="//imasdk.googleapis.com/js/sdkloader/cast_dai.js"></script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();
    const streamManager = new google.ima.cast.dai.api.StreamManager();

    castContext.start();
  </script>
</body>
</html>

Create the Stream Manager Load Interceptor

Before your media items are passed to CAF, create your stream request in a LOAD message interceptor .

    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();
    const streamManager = new google.ima.cast.dai.api.StreamManager();

    /**
     * Creates a livestream request object for a Pod Serving stream.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {StreamRequest} an IMA stream request
     */
    const createStreamRequest = (castRequest) => { /* ... */};

    /**
     * Initates a DAI stream request for the final stream manifest.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {Promise<LoadRequestData>} a promise that resolves to an updated castRequest, containing the DAI stream manifest
     */
    const createDAICastRequest = (castRequest) => {
        return streamManager.requestStream(castRequest, createStreamRequest(castRequest))
          .then((castRequestWithPodStreamData) => {
            console.log('Successfully made DAI stream request.');
            // ...
            return castRequestWithPodStreamData;
          })
          .catch((error) => {
            console.log('Failed to make DAI stream request.');
            // CAF will automatically fallback to the content URL
            // that it can read from the castRequest object.
            return castRequest;
          });
    };

    playerManager.setMessageInterceptor(
        cast.framework.messages.MessageType.LOAD, createDAICastRequest);

    castContext.start();

Create the stream request

Complete the createStreamRequest function to create a Pod Serving stream based on the CAF load request.

    /**
     * Creates a livestream request object for a Pod Serving stream.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {StreamRequest} an IMA stream request
     */
    const createStreamRequest = (castRequest) => {
      const customData = castRequest.media.customData;
      let streamRequest;
      if (customData.daiStreamType == "LIVE") {
        streamRequest = new google.ima.cast.dai.api.PodStreamRequest();
        streamRequest.customAssetKey = customData.customAssetKey;
        streamRequest.networkCode = customData.networkCode;
        streamRequest.apiKey = customData.apiKey;
      } else if (customData.daiStreamType == "VOD") {
        streamRequest = new google.ima.cast.dai.api.PodVodStreamRequest();
        streamRequest.networkCode = customData.networkCode;
        streamRequest.apiKey = customData.apiKey;
      }
      return streamRequest;
    };

Retrieve the stitched manifest from your VTP

If your stream request is successful, use streamManager.getStreamId() to retrieve the stream's ID. Your Video Technical Partner (VTP) or custom manifest manipulator will provide instructions to retrieve a manifest URL, using this stream ID.

Once you have retrieved your manifest URL, replace the existing contentUrl with the new manifestUrl .

Lastly, before returning the modified stream manifest, call the loadStreamMetadata method on your streamManager to inform the IMA SDK that it can safely request stream metadata. This call is only necessary for VOD streams.

    /**
     * Initates a DAI stream request for the final stream manifest.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {Promise<LoadRequestData>} a promise that resolves to an updated castRequest, containing the DAI stream manifest
     */
    const createDAICastRequest = (castRequest) => {
        return streamManager.requestStream(castRequest, createStreamRequest(castRequest))
          .then((castRequestWithPodStreamData) => {
            console.log('Successfully made DAI stream request.');

            // This is a sample VTP integration. Consult your VTP documentation
            // for how to retrieve an ad-stitched stream manifest URL.
            const manifestTemplate = "https://.../manifest.m3u8?gam_stream_id=[[STREAMID]]";
            const streamId = streamManager.getStreamId();
            const manifestUrl = manifestTemplate.replace('[[STREAMID]]', streamId)
            // Assign your manifestUrl to the request's content URL.
            castRequestWithPodStreamData.media.contentUrl = manifestUrl;

            // After generating the manifest URL, VOD streams must notify the
            // IMA SDK that it is safe to request ad pod metadata.
            // This is only necessary for VOD streams. It is a no-op for
            // livestreams, so no conditional is needed.
            streamManager.loadStreamMetadata();

            return castRequestWithPodStreamData;
          })
          .catch((error) => {
            console.log('Failed to make DAI stream request.');
            // CAF will automatically fallback to the content URL
            // that it can read from the castRequest object.
            return castRequest;
          });
    };

IMA DAI সম্পদ পরিষ্কার করুন

IMA DAI SDK ব্যবহার করে একটি পড সার্ভিং স্ট্রিমে বিজ্ঞাপন অনুরোধ করা এবং প্রদর্শন করা সফলভাবে শেষ করার পর, আমরা পরামর্শ দিই যে পড সার্ভিং সেশনটি সম্পূর্ণ হলে আপনি সমস্ত রিসোর্স পরিষ্কার করে ফেলুন। স্ট্রিম প্লেব্যাক বন্ধ করতে, সমস্ত বিজ্ঞাপন ট্র্যাকিং বন্ধ করতে এবং লোড হওয়া সমস্ত স্ট্রিম অ্যাসেট মুক্ত করতে StreamManager.destroy() কল করুন।

,
প্ল্যাটফর্ম নির্বাচন করুন: HTML5 Android iOS tvOS Cast Roku

আপনার পছন্দের DAI সমাধানটি নির্বাচন করুন।

পড সার্ভিং ডিএআই

IMA SDKs simplify integrating multimedia ads into your websites and apps.

IMA SDKs can request ads from any VAST-compliant ad server and manage ad playback in your apps.

With IMA DAI SDKs, apps make a stream request for ad and content video for either VOD or live content. The SDK then returns a combined video stream, so that you don't have to manage switching between ad and content video within your app.

This guide demonstrates how to play a DAI Pod Serving stream, using the IMA DAI SDK for CAF.

Before using this guide, familiarize yourself with the Chromecast Application Framework's Web Receiver protocol. This guide assumes a basic understanding of CAF receiver concepts, such as message interceptors and mediaInformation objects, and familiarity with using the Cast Command and Control tool , to emulate a CAF sender.

To use IMA DAI Pod Serving, you must be working with a Pod Serving partner and must have an Ad Manager 360 Advanced account. If you have an Ad Manager account, contact your account manager for more details. For information about signing up for Ad Manager, visit the Ad Manager Help Center .

For information on integrating with other platforms, or on using the IMA client-side SDKs, see Interactive Media Ads SDKs .

IMA DAI Pod Serving overview

Implementing Pod Serving using the IMA CAF DAI SDK involves two main components, which are demonstrated in this guide:

  • StreamRequest : An object that defines a stream request to Google's advertising servers. Requests specify a Network Code, Custom Asset Key, and an optional API key, as well as other optional parameters.
  • StreamManager : একটি অবজেক্ট যা ভিডিও স্ট্রিম এবং IMA DAI SDK-এর মধ্যে যোগাযোগ পরিচালনা করে, যেমন ট্র্যাকিং পিং পাঠানো এবং স্ট্রিম ইভেন্টগুলোকে পাবলিশারের কাছে ফরোয়ার্ড করা।

পূর্বশর্ত

  • A Cast Developer Console account with registered test devices.
  • A hosted web receiver app that is registered with your Cast Developer Console and which can be modified to host the code provided by this guide.
  • A sending app that is configured to use your web receiver app. For the purposes of this example, use the Cast Command and Control tool as your sender.

Configure the sender's MediaInfo objects

First, configure your sender app's MediaInfo object to include the following fields:

মাঠ বিষয়বস্তু
contentId A unique identifier for this media item.

CONTENT_ID

contentUrl Optional. Backup stream URL to play if the DAI stream fails to load.

BACKUP_STREAM_URL

contentType Optional. Mimetype of the content backup streams. Only needed for DASH streams .

CONTENT_STREAM_MIMETYPE

streamType The string literal or constant used for this value varies by sender platform.
customData The customData field contains a key-value store of additional required fields. In this sample, it contains your DAI stream parameters. In a production app you might instead pass an identifier that your cast receiver app would use to retrieve these parameters with a server-side request.
মাঠ বিষয়বস্তু
daiStreamType The type of your DAI stream. one of either "LIVE" or "VOD"

DAI_STREAM_TYPE

networkCode The network code for your Google Ad Manager 360 account.

NETWORK_CODE

customAssetKey This field is needed for Live streams only. The custom asset key that identifies your Pod Serving event in Google Ad Manager 360.

CUSTOM_ASSET_KEY

apiKey An optional API key to retrieve a Stream ID from the IMA DAI SDK.

API_KEY

Here are some code samples to help you get started:

ওয়েব

To configure these values in a Cast web sender, first create a MediaInfo object with the required data, then make a load request to the web receiver.

// Create mediaInfo object
const mediaInfo = new chrome.cast.media.MediaInfo("CONTENT_ID");
mediaInfo.contentUrl = "BACKUP_STREAM_URL";
mediaInfo.contentType = "CONTENT_STREAM_MIMETYPE";
mediaInfo.streamType = chrome.cast.media.StreamType.LIVE;
mediaInfo.customData = {
  daiStreamType: "DAI_STREAM_TYPE",
  networkCode: "NETWORK-CODE",
  customAssetKey: "CUSTOM_ASSET_KEY",
  apiKey: "API_KEY"
};

// Make load request to cast web receiver
const castSession = cast.framework.CastContext.getInstance().getCurrentSession();
const request = new chrome.cast.media.LoadRequest(mediaInfo);
castSession.loadMedia(request).then(
  () => { console.log('Load succeed'); },
  (errorCode) => { console.log('Error code: ' + errorCode); });

অ্যান্ড্রয়েড

To configure these values in a Cast web sender, first create a MediaInfo object with the required data, then make a load request to the web receiver.

JSONObject customData = new JSONObject()?
  .put("daiStreamType", "DAI_STREAM_TYPE")
  .put("networkCode", "NETWORK-CODE")
  .put("customAssetKey", "CUSTOM_ASSET_KEY")
  .put("apiKey", "API_KEY");
MediaInfo mediaInfo = MediaInfo.Builder("CONTENT_ID")
  .setContentUrl("BACKUP_STREAM_URL")
  .setContentType("CONTENT_STREAM_MIMETYPE")
  .setStreamType(MediaInfo.STREAM_TYPE_LIVE)
  .setCustomData(customData)
  .build();

RemoteMediaClient remoteMediaClient = mCastSession.getRemoteMediaClient();
remoteMediaClient.load(new MediaLoadRequestData.Builder().setMediaInfo(mediaInfo).build());

iOS (Obj-C)

To configure these values in a Cast web sender, first create a GCKMediaInformation object with the required data, then make a load request to the web receiver.

NSURL url = [NSURL URLWithString:@"BACKUP_STREAM_URL"];
NSDictionary *customData = @{
  @"daiStreamType": @"DAI_STREAM_TYPE",
  @"networkCode": @"NETWORK-CODE",
  @"customAssetKey": @"CUSTOM_ASSET_KEY",
  @"apiKey": @"API_KEY"};
mediaInfoBuilder.customData = customData;

GCKMediaInformationBuilder *mediaInfoBuilder =
  [[GCKMediaInformationBuilder alloc] initWithContentID: @"CONTENT_ID"];
mediaInfoBuilder.contentURL = url;
mediaInfoBuilder.contentType = @"CONTENT_STREAM_MIMETYPE";
mediaInfoBuilder.streamType = GCKMediaStreamTypeLive;
mediaInfoBuilder.customData = customData;
self.mediaInformation = [mediaInfoBuilder build];

GCKRequest *request = [self.sessionManager.currentSession.remoteMediaClient loadMedia:self.mediaInformation];
if (request != nil) {
  request.delegate = self;
}

iOS (Swift)

To configure these values in a Cast web sender, first create a GCKMediaInformation object with the required data, then make a load request to the web receiver.

let url = URL.init(string: "BACKUP_STREAM_URL")
guard let mediaURL = url else {
  print("invalid mediaURL")
  return
}

let customData = [
  "daiStreamType": "DAI_STREAM_TYPE",
  "networkCode": "NETWORK-CODE",
  "customAssetKey": "CUSTOM_ASSET_KEY",
  "region": "API_KEY"
]

let mediaInfoBuilder = GCKMediaInformationBuilder.init(contentId: "CONTENT_ID")
mediaInfoBuilder.contentURL = mediaUrl
mediaInfoBuilder.contentType = @"CONTENT_STREAM_MIMETYPE"
mediaInfoBuilder.streamType = GCKMediaStreamType.Live
mediaInfoBuilder.customData = customData
mediaInformation = mediaInfoBuilder.build()

guard let mediaInfo = mediaInformation else {
  print("invalid mediaInformation")
  return
}

if let request = sessionManager.currentSession?.remoteMediaClient?.loadMedia
(mediaInfo) {
  request.delegate = self
}

CAC tool

To configure these values in the Cast Command and Control tool , click the Load Media tab, and set the custom load request type to LOAD. Then replace the JSON data in the text area with this JSON:

{
  "media": {
    "contentId": "CONTENT_ID",
    "contentUrl": "BACKUP_STREAM_URL",
    "contentType": ""CONTENT_STREAM_MIMETYPE"",
    "streamType": "LIVE",
    "customData": {
      "daiStreamType": "DAI_STREAM_TYPE",
      "networkCode": "NETWORK-CODE",
      "customAssetKey": "CUSTOM_ASSET_KEY",
      "oAuthToken": "API_KEY"
    }
  }
}

This custom load request can be sent to the receiver to test the rest of the steps.

Create a basic CAF receiver

Create a custom web receiver, as seen in the CAF SDK Custom Web Receiver Guide .

Your receiver's code should look like this:

<html>
<head>
  <script
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js">
  </script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    // ...
  </script>
</body>
</html>

Import the IMA DAI SDK and get the Player Manager

Add a script tag to import the IMA DAI SDK for CAF to your web receiver, just after the script loading CAF. In the script tag, store the receiver context and player manager as constants before starting the receiver.

<html>
<head>
  <script
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
  <script src="//imasdk.googleapis.com/js/sdkloader/cast_dai.js"></script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();

    castContext.start();
  </script>
</body>
</html>

Initialize the IMA Stream Manager

Initialize the IMA Stream Manager.

<html>
<head>
  <script type="text/javascript"
      src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
  <script src="//imasdk.googleapis.com/js/sdkloader/cast_dai.js"></script>
</head>
<body>
  <cast-media-player></cast-media-player>
  <script>
    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();
    const streamManager = new google.ima.cast.dai.api.StreamManager();

    castContext.start();
  </script>
</body>
</html>

Create the Stream Manager Load Interceptor

Before your media items are passed to CAF, create your stream request in a LOAD message interceptor .

    const castContext = cast.framework.CastReceiverContext.getInstance();
    const playerManager = castContext.getPlayerManager();
    const streamManager = new google.ima.cast.dai.api.StreamManager();

    /**
     * Creates a livestream request object for a Pod Serving stream.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {StreamRequest} an IMA stream request
     */
    const createStreamRequest = (castRequest) => { /* ... */};

    /**
     * Initates a DAI stream request for the final stream manifest.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {Promise<LoadRequestData>} a promise that resolves to an updated castRequest, containing the DAI stream manifest
     */
    const createDAICastRequest = (castRequest) => {
        return streamManager.requestStream(castRequest, createStreamRequest(castRequest))
          .then((castRequestWithPodStreamData) => {
            console.log('Successfully made DAI stream request.');
            // ...
            return castRequestWithPodStreamData;
          })
          .catch((error) => {
            console.log('Failed to make DAI stream request.');
            // CAF will automatically fallback to the content URL
            // that it can read from the castRequest object.
            return castRequest;
          });
    };

    playerManager.setMessageInterceptor(
        cast.framework.messages.MessageType.LOAD, createDAICastRequest);

    castContext.start();

Create the stream request

Complete the createStreamRequest function to create a Pod Serving stream based on the CAF load request.

    /**
     * Creates a livestream request object for a Pod Serving stream.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {StreamRequest} an IMA stream request
     */
    const createStreamRequest = (castRequest) => {
      const customData = castRequest.media.customData;
      let streamRequest;
      if (customData.daiStreamType == "LIVE") {
        streamRequest = new google.ima.cast.dai.api.PodStreamRequest();
        streamRequest.customAssetKey = customData.customAssetKey;
        streamRequest.networkCode = customData.networkCode;
        streamRequest.apiKey = customData.apiKey;
      } else if (customData.daiStreamType == "VOD") {
        streamRequest = new google.ima.cast.dai.api.PodVodStreamRequest();
        streamRequest.networkCode = customData.networkCode;
        streamRequest.apiKey = customData.apiKey;
      }
      return streamRequest;
    };

Retrieve the stitched manifest from your VTP

If your stream request is successful, use streamManager.getStreamId() to retrieve the stream's ID. Your Video Technical Partner (VTP) or custom manifest manipulator will provide instructions to retrieve a manifest URL, using this stream ID.

Once you have retrieved your manifest URL, replace the existing contentUrl with the new manifestUrl .

Lastly, before returning the modified stream manifest, call the loadStreamMetadata method on your streamManager to inform the IMA SDK that it can safely request stream metadata. This call is only necessary for VOD streams.

    /**
     * Initates a DAI stream request for the final stream manifest.
     * @param {!LoadRequestData} castRequest The request object from the cast sender
     * @return {Promise<LoadRequestData>} a promise that resolves to an updated castRequest, containing the DAI stream manifest
     */
    const createDAICastRequest = (castRequest) => {
        return streamManager.requestStream(castRequest, createStreamRequest(castRequest))
          .then((castRequestWithPodStreamData) => {
            console.log('Successfully made DAI stream request.');

            // This is a sample VTP integration. Consult your VTP documentation
            // for how to retrieve an ad-stitched stream manifest URL.
            const manifestTemplate = "https://.../manifest.m3u8?gam_stream_id=[[STREAMID]]";
            const streamId = streamManager.getStreamId();
            const manifestUrl = manifestTemplate.replace('[[STREAMID]]', streamId)
            // Assign your manifestUrl to the request's content URL.
            castRequestWithPodStreamData.media.contentUrl = manifestUrl;

            // After generating the manifest URL, VOD streams must notify the
            // IMA SDK that it is safe to request ad pod metadata.
            // This is only necessary for VOD streams. It is a no-op for
            // livestreams, so no conditional is needed.
            streamManager.loadStreamMetadata();

            return castRequestWithPodStreamData;
          })
          .catch((error) => {
            console.log('Failed to make DAI stream request.');
            // CAF will automatically fallback to the content URL
            // that it can read from the castRequest object.
            return castRequest;
          });
    };

IMA DAI সম্পদ পরিষ্কার করুন

IMA DAI SDK ব্যবহার করে একটি পড সার্ভিং স্ট্রিমে বিজ্ঞাপন অনুরোধ করা এবং প্রদর্শন করা সফলভাবে শেষ করার পর, আমরা পরামর্শ দিই যে পড সার্ভিং সেশনটি সম্পূর্ণ হলে আপনি সমস্ত রিসোর্স পরিষ্কার করে ফেলুন। স্ট্রিম প্লেব্যাক বন্ধ করতে, সমস্ত বিজ্ঞাপন ট্র্যাকিং বন্ধ করতে এবং লোড হওয়া সমস্ত স্ট্রিম অ্যাসেট মুক্ত করতে StreamManager.destroy() কল করুন।