0

大家好,只是想知道是否有人知道我们需要做什么才能从发件人应用程序在 chrome cast 上播放 IMA 广告,据我了解,阅读文档的唯一方法是使用 pubads URL 向 chromecast 接收器发送消息:

private void loadMedia(MediaInfo mediaInfo, Boolean autoplay) {
    try {
        Log.d(TAG, "loading media");
        mRemoteMediaPlayer.load(sApiClient, mediaInfo, autoplay)
                .setResultCallback(new ResultCallback<RemoteMediaPlayer.MediaChannelResult>() {
                    @Override
                    public void onResult(RemoteMediaPlayer.MediaChannelResult result) {
                        if (result.getStatus().isSuccess()) {
                            boolean adStarted = mVideoPlayerController.hasAdStarted();
                            if (mVideoFragment.isVmap() || !adStarted) {
                                sendMessage("requestAd," + mAdTagUrl + ","
                                        + mVideoPlayerController.getCurrentContentTime());
                            } else {
                                sendMessage("seek,"
                                    + mVideoPlayerController.getCurrentContentTime());
                            }
                        } else {
                            Log.e(TAG, "Error loading Media : "
                                    + result.getStatus().getStatusCode());
                        }

仅供参考:mAdTagUrl 是“pubads”链接

前酒吧链接:

https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=
4

1 回答 1

0

万一有人在寻找答案:

它实际上在 AdBreak Clip Info Builder -> setVastAdsRequest() 方法中。

将“pubads”链接传递给此方法,您就可以开始了。

于 2021-12-08T03:40:39.077 回答