• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java VideoOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.gms.ads.VideoOptions的典型用法代码示例。如果您正苦于以下问题:Java VideoOptions类的具体用法?Java VideoOptions怎么用?Java VideoOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VideoOptions类属于com.google.android.gms.ads包,在下文中一共展示了VideoOptions类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreate

import com.google.android.gms.ads.VideoOptions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Locate the NativeExpressAdView.
    mAdView = findViewById(R.id.adView);

    // Set its video options.
    mAdView.setVideoOptions(new VideoOptions.Builder()
            .setStartMuted(true)
            .build());

    // The VideoController can be used to get lifecycle events and info about an ad's video
    // asset. One will always be returned by getVideoController, even if the ad has no video
    // asset.
    mVideoController = mAdView.getVideoController();
    mVideoController.setVideoLifecycleCallbacks(new VideoController.VideoLifecycleCallbacks() {
        @Override
        public void onVideoEnd() {
            Log.d(LOG_TAG, "Video playback is finished.");
            super.onVideoEnd();
        }
    });

    // Set an AdListener for the AdView, so the Activity can take action when an ad has finished
    // loading.
    mAdView.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            if (mVideoController.hasVideoContent()) {
                Log.d(LOG_TAG, "Received an ad that contains a video asset.");
            } else {
                Log.d(LOG_TAG, "Received an ad that does not contain a video asset.");
            }
        }
    });

    mAdView.loadAd(new AdRequest.Builder().build());
}
 
开发者ID:googlesamples,项目名称:android-ads,代码行数:41,代码来源:MainActivity.java


示例2: initData

import com.google.android.gms.ads.VideoOptions; //导入依赖的package包/类
private void initData() {
    //初始化firebase 统计
    FirebaseAnalytics.getInstance(getApplicationContext());
    //创建广告请求
    adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)//所有的模拟器
            .addTestDevice("74BAABC1A0E77EB8C34896404447DBEC")//nexus 5
            .addTestDevice("E3A8BB93EE8D9CF7C0B5351AB456C4C5")//我的锤子M1L
            .build();
    //横幅广告
    adv_banner.loadAd(adRequest);

    //插页广告
    interstitialAd = new InterstitialAd(this);
    interstitialAd.setAdUnitId(getString(R.string.insert_ad_unit_id));//设置单元id
    //增加监听
    interstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            //关闭了这个广告先加载下一个广告
            requestNewInterstitial();
        }
    });
    //加载插页广告
    requestNewInterstitial();

    neadv_native.setAdListener(new AdListener() {
        @Override
        public void onAdFailedToLoad(int i) {
            Log.d("AdListener", "onAdFailedToLoad i:" + i);
            super.onAdFailedToLoad(i);
        }
    });
    // Set its video options.
    neadv_native.setVideoOptions(new VideoOptions.Builder()
            .setStartMuted(true)
            .build());

    // The VideoController can be used to get lifecycle events and info about an ad's video
    // asset. One will always be returned by getVideoController, even if the ad has no video
    // asset.
    mVideoController = neadv_native.getVideoController();
    mVideoController.setVideoLifecycleCallbacks(new VideoController.VideoLifecycleCallbacks() {
        @Override
        public void onVideoEnd() {
            Log.d("onVideoEnd", "Video playback is finished.");
            super.onVideoEnd();
        }
    });

    // Set an AdListener for the AdView, so the Activity can take action when an ad has finished
    // loading.
    neadv_native.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            if (mVideoController.hasVideoContent()) {
                Log.d("onAdLoaded", "Received an ad that contains a video asset.");
            } else {
                Log.d("onAdLoaded", "Received an ad that does not contain a video asset.");
            }
        }
    });
    //加载原生广告
    neadv_native.loadAd(new AdRequest.Builder().build());
}
 
开发者ID:yy1300326388,项目名称:Firebase,代码行数:66,代码来源:MainActivity.java


示例3: getVideoOptions

import com.google.android.gms.ads.VideoOptions; //导入依赖的package包/类
public VideoOptions getVideoOptions() {
    return videoOptions;
}
 
开发者ID:clockbyte,项目名称:admobadapter,代码行数:4,代码来源:ExpressAdPreset.java


示例4: setVideoOptions

import com.google.android.gms.ads.VideoOptions; //导入依赖的package包/类
public void setVideoOptions(VideoOptions videoOptions) {
    this.videoOptions = videoOptions;
}
 
开发者ID:clockbyte,项目名称:admobadapter,代码行数:4,代码来源:ExpressAdPreset.java



注:本文中的com.google.android.gms.ads.VideoOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JenaException类代码示例发布时间:2022-05-22
下一篇:
Java Pair类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap