微信小程序搜索:短視頻去水印解析
目前微信小程序針對(duì)個(gè)人來(lái)說(shuō)廣告是最好的變現(xiàn)方式,廣告主要分為:
1. Banner
2. 激勵(lì)式視頻
3. 插屏
Banner廣告很簡(jiǎn)單,插入代碼就可以顯示
這里介紹下激勵(lì)式視頻廣告實(shí)現(xiàn)(觀看完整廣告獎(jiǎng)勵(lì)積分):
//視頻廣告 let videoAd = null; //視頻廣告拉取狀態(tài) let videoAdPushStatus = false; Page({ data: { //積分總數(shù) creditsAmountSum: 100 }, onLoad(options) { let that = this; that.videoAdShowSetting(); }, onShow() { }, videoAdShowSetting: function() { var that = this; if (wx.createRewardedVideoAd) { videoAd = wx.createRewardedVideoAd({ adUnitId: '自己申請(qǐng)的廣告ID' }) videoAd.onLoad(() => { //設(shè)置廣告拉取成功 videoAdPushStatus = true; }); videoAd.onClose((status) => { if (status && status.isEnded || status === undefined) { //正常播放結(jié)束,可以下發(fā)獎(jiǎng)勵(lì) that.addUserCredits(); } else { //不下發(fā)獎(jiǎng)勵(lì) wx.showModal({ content: '廣告未播放完成,無(wú)法獲取積分', showCancel: false }) } }); videoAd.onError(() => { that.showToast('獲取積分異常,請(qǐng)稍后重試'); }); } }, //顯示廣告 bindAddCredits: function() { let that = this; that.showVideoAd(); }, //視頻廣告 showVideoAd: function() { let that = this; videoAd.load() .then(() => { //重置視頻廣告拉取狀態(tài) videoAdPushStatus = false; videoAd.show(); }) .catch(err => { that.showToast('加載異常,請(qǐng)稍后重試...'); }); }, addUserCredits: function() { let that = this; that.setData({ creditsAmountSum: 10, }); that.showSuccessToast('已獲取積分+10'); }, showSuccessToast(title) { wx.showToast({ title: title, icon: 'success', duration: 3000 }) }, showToast(title) { wx.showToast({ title: title, icon: 'none', duration: 2000 }) } });
文章題目:微信小程序激勵(lì)式視頻廣告組件使用詳解-創(chuàng)新互聯(lián)
鏈接URL:http://www.chinadenli.net/article42/dpichc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營(yíng)銷(xiāo)、網(wǎng)站導(dǎo)航、靜態(tài)網(wǎng)站、微信公眾號(hào)、微信小程序、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容