//快手激励视频
private void showKuaishouJilishipinAd(long posId) {
KsScene.Builder builder = new KsScene.Builder(posId)
.screenOrientation(SdkConfig.SCREEN_ORIENTATION_UNKNOWN);
KsScene scene = builder.build(); // 此为测试posId,请联系快手平台申请正式posId
// 请求的期望屏幕方向传递为1,表示期望为竖屏
KsAdSDK.getLoadManager().loadRewardVideoAd(scene, new KsLoadManager.RewardVideoAdListener() {
@Override
public void onError(int code, String msg) {
// ToastUtil.showToast(mContext, "激励视频广告请求失败" + code + msg);
}
@Override
public void onRequestResult(int adNumber) {
// ToastUtil.showToast(mContext, "激励视频广告请求结果返回 " + adNumber);
}
@Override
public void onRewardVideoAdLoad(@Nullable List<KsRewardVideoAd> adList) {
// ToastUtil.showToast(mContext, "激励视频广告请求成功");
KsVideoPlayConfig videoPlayConfig = new KsVideoPlayConfig.Builder()
.showLandscape(false)
.build();
KsRewardVideoAd mRewardVideoAd = adList.get(0);
mRewardVideoAd
.setRewardAdInteractionListener(new KsRewardVideoAd.RewardAdInteractionListener() {
@Override
public void onAdClicked() {
// ToastUtil.showToast(mContext, "激励视频广告点击");
}
@Override
public void onPageDismiss() {
// ToastUtil.showToast(mContext, "激励视频广告关闭");
}
@Override
public void onVideoPlayError(int code, int extra) {
// ToastUtil.showToast(mContext, "激励视频广告播放出错");
}
@Override
public void onVideoPlayEnd() {
// ToastUtil.showToast(mContext, "激励视频广告播放完成");
}
@Override
public void onVideoPlayStart() {
// ToastUtil.showToast(mContext, "激励视频广告播放开始");
}
@Override
public void onRewardVerify() {
// ToastUtil.showToast(mContext, "激励视频广告获取激励");
}
});
mRewardVideoAd.showRewardVideoAd(ShareGoldActivity.this, videoPlayConfig);
}
});
}
网友评论