概述

當內容播放時,瀏覽器TVSDK可在建立MediaResource物件時顯示廣告並傳遞廣告相關資訊。

在收到AdobePSDK.MediaPlayerStatus.INITIALIZED後,您可以選擇呼叫prepareToPlay函式。

function onStatusChange (event) { 
   switch (event.status) { 
     case AdobePSDK.MediaPlayerStatus.INITIALIZED: 
        player.prepareToPlay(AdobePSDK.MediaPlayer.LIVE_POINT); 
        break; 
     case AdobePSDK.MediaPlayerStatus.PREPARED: 
        player.play(); 
        break; 
   } 
} 
 
var auditudeSettings     = new AdobePSDK.AuditudeSettings(); 
auditudeSettings.domain  = "sample_auditude_domain"; 
auditudeSettings.mediaId = "sample_media_id"; 
auditudeSettings.zoneId  = "sample_zone_id"; 
 
// event handler 
player.addEventListener(AdobePSDK.PSDKEventType.STATUS_CHANGED, onStatusChange); 
 
var mediaResource = new AdobePSDK.MediaResource(resourceUrl, resourceType, auditudeSettings, false);

瀏覽器TVSDK也提供下列特定廣告事件,您可在事件處理常式中使用這些事件,以防止廣告播放時內容快速轉送:

  • AdobePSDK.PSDKEventType.AD_BREAK_STARTED
  • AdobePSDK.PSDKEventType.AD_BREAK_COMPLETED
  • AdobePSDK.PSDKEventType.AD_STARTED
  • AdobePSDK.PSDKEventType.AD_COMPLETED

若要在UI Framework中檢視此功能,請在設定中指定廣告設定,如下所示:

// Using UI Framework 
var playerWrapper = ptp.videoPlayer('.videoDiv', { 
    player: { 
        mediaResource: { 
 
            resourceUrl:'Specify Resource Url', 
 
            auditudeSettings: { 
                validMimeTypes: ["application/x-mpeURL"], 
                domain: "Sample_auditude_domain", 
                mediaId:"sample_media_id", 
                zoneID:"sample_zone_id", 
                creativeRepackagingEnabled:true 
            } 
        } 
    } 
}; 

如需所需AuditudeSettings的詳細資訊,請參閱廣告插入中繼資料

本頁內容