0

我创建了一个基本的 CAF 接收器,并尝试使用 mediaInformation 的“vmapAdsRequest”在 chromecast 上播放广告。正在播放广告,但我无法暂停、恢复或更改广告音量。如果我使用相同的发件人应用程序播放 Vpaid 广告,我可以这样做。

/**
 * @param {!cast.framework.messages.MediaInformation} mediaInformation
 */
function addBreakToMedia(mediaInformation) {
  // VMAP Ads -
  mediaInformation.vmapAdsRequest = {
    adTagUrl: 'https://pulse-demo.videoplaza.tv/proxy/distributor/v2?rt=vmap_1.0&t=standard-linears,allSupportedAds&bp=10,30&xpb=1&rnd=' + Math.floor(Math.random() * 10000)
  }
}


// acquiring a reference to CastReceiverContext, your primary entry point to the whole Receiver SDK
var context = cast.framework.CastReceiverContext.getInstance();
//storing a reference to the PlayerManager, the object handling playback and providing you with all the hooks you need to plug-in your own custom logic
var playerManager = context.getPlayerManager();

playerManager.setMessageInterceptor(
  cast.framework.messages.MessageType.LOAD,
  loadRequestData => {
    addBreakToMedia(loadRequestData.media);
    return loadRequestData;
  }
);

//Initializing the SDK by calling start() on CastReceiverContext
context.start();
4

0 回答 0