स्किप करने की संभावना

CAF DAI SDK टूल के ज़रिए, स्किप किए जा सकने वाले विज्ञापनों का अनुरोध करना और उन्हें दिखाना एक मुश्किल काम है. इसके लिए, यह ज़रूरी है कि इस्तेमाल करने वाले और भेजने वालों के कॉम्बिनेशन में, 'स्किप करें' बटन दिखाया जा सके और उसके साथ इंटरैक्ट किया जा सके.

SDK टूल, अपने-आप यह पता लगाने की पूरी कोशिश करेगा कि मौजूदा पाने वाले व्यक्ति के पास, सीधे 'अभी नहीं' बटन को रेंडर करने और उससे इंटरैक्ट करने की सुविधा है या नहीं. हालांकि, पब्लिशर को यह तय करना होता है कि अटैच किया गया कोई भी ईमेल, imaRequestData.senderCanSkip एट्रिब्यूट को टॉगल करके, स्किप किए जा सकने वाले विज्ञापन दिखा सकता है या नहीं.

CAF DAI SDK टूल के सभी नमूनों में, मीडिया ऑब्जेक्ट के हिस्से के तौर पर, भेजने वाले केनस्केप को सीधे भेजने वाले से पास किया जाता है. यह प्रक्रिया को जान-बूझकर लागू किया गया है. यह एक भेजने वाले के लिए अच्छी तरह काम करती है. हालांकि, असल दुनिया के ऐप्लिकेशन में भेजने वाले कई ऐप्लिकेशन में CAF रिसीवर अटैच किया जा सकता है. जब मीडिया ऑब्जेक्ट लोड होता है और स्ट्रीम का अनुरोध किया जाता है, तब मीडिया फ़ाइल की सूची बनाने वाले को कनेक्ट नहीं किया जा सकता.

ज़्यादा बेहतर पाने वाले इस बात पर नज़र रख सकते हैं कि मैसेज भेजने वाले किस तरह के सहयोगी, स्किप करने की सुविधा देते हैं और किन्हें नहीं. साथ ही, यह भी देखें कि लोड होने के समय, मैसेज पाने वाले व्यक्ति के साथ कोई ऐसा मैसेज अटैच तो नहीं है.

उदाहरण (एक ईमेल भेजने वाला):

...

    let getStreamRequest = (request) => {
      const imaRequestData = request.media.customData;
      let streamRequest = null;
      if (imaRequestData.assetKey) {
        // Live stream
        streamRequest = new google.ima.cast.dai.api.LiveStreamRequest();
        streamRequest.assetKey = imaRequestData.assetKey;
      } else if (imaRequestData.contentSourceId) {
        // VOD stream
        streamRequest = new google.ima.cast.dai.api.VODStreamRequest();
        streamRequest.contentSourceId = imaRequestData.contentSourceId;
        streamRequest.videoId = imaRequestData.videoId;
      }
      if (streamRequest && imarequestdata.ApiKey) {
        streamRequest.ApiKey = imarequestdata.ApiKey;
      }
      if (streamRequest && imarequestdata.senderCanSkip) {
        streamRequest.senderCanSkip = imaRequestData.senderCanSkip;
      }
      return streamRequest;
    };
...

उदाहरण (मल्टी-भेजने वाले की सहायता):

...

    let getStreamRequest = (request) => {
      const imaRequestData = request.media.customData;
      let streamRequest = null;
      if (imaRequestData.assetKey) {
        // Live stream
        streamRequest = new google.ima.cast.dai.api.LiveStreamRequest();
        streamRequest.assetKey = imaRequestData.assetKey;
      } else if (imaRequestData.contentSourceId) {
        // VOD stream
        streamRequest = new google.ima.cast.dai.api.VODStreamRequest();
        streamRequest.contentSourceId = imaRequestData.contentSourceId;
        streamRequest.videoId = imaRequestData.videoId;
      }
      if (streamRequest && imarequestdata.ApiKey) {
        streamRequest.ApiKey = imarequestdata.ApiKey;
      }

      let senders = castContext.getSenders();
      let senderCanSkip = (sender) => {
        const skippableUserAgents = [
          "iOS CastSDK",
          "Android CastSDK"
        ];
        // trim user agent to just include device
        let userAgent = sender.userAgent.explode(',')[0];
        return skippableUserAgents.includes(userAgent);
      };
      if (streamRequest && senders.some(senderCanSkip)) {
        streamRequest.senderCanSkip = imarequestdata.senderCanSkip;
      }
      return streamRequest;
    };

...

कुल मिलाकर, पब्लिशर अपने उपयोगकर्ताओं के अनुभव के लिए ज़िम्मेदार होते हैं. इसलिए, हो सकता है कि स्किप किए जा सकने वाले सभी भेजने वाले, स्ट्रीम का अनुरोध किए जाने और विज्ञापन चलाए जाने के बीच डिसकनेक्ट हो जाएं. इसलिए, आपको STARTED इवेंट के लिए एक हैंडलर अटैच करना होगा. इस हैंडलर से यह पता चलता है कि कोई विज्ञापन स्किप किया जा सकता है या नहीं. साथ ही, यह भी देख सकता है कि भेजने और पाने वाला, स्किप करने लायक नहीं हैं. अगर ये विज्ञापन दिखते हैं, तो ये विज्ञापन अपने-आप स्किप हो सकते हैं. हालांकि, इस तरह के बेहतर तरीके से लागू करना, CAF DAI की सुविधा के दायरे से बाहर है.

अगर ऐसा कोई मामला होता है, तो उपयोगकर्ता डिफ़ॉल्ट रूप से स्किप करने की सुविधा देने वाले सेंडर को कनेक्ट करने के बाद, स्किप बटन पर क्लिक करके तकनीकी रूप से स्किप शुरू कर सकता है.