Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
llewan-weixin-sdk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
llewan
llewan-weixin-sdk
Commits
7adec80a
Commit
7adec80a
authored
Oct 08, 2018
by
liuxinjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加视频成功和失败回调
parent
6a7544f5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
sdk.js
assets/llewan-weixin-sdk/sdk.js
+28
-0
No files found.
assets/llewan-weixin-sdk/sdk.js
View file @
7adec80a
...
...
@@ -58,6 +58,11 @@ var sdk = {
userid
:
0
,
initFlag
:
0
,
//视频成功回调
videoSuccess
:
null
,
//视频失败回调
videoFail
:
null
,
/**
* @apiGroup A
* @apiName init
...
...
@@ -1334,11 +1339,18 @@ var sdk = {
*
* @apiSuccessExample {json} 示例:
* //.参考文档:https://developers.weixin.qq.com/minigame/dev/document/ad/wx.createRewardedVideoAd.html
* sdk.vedioSuccess = function(){
* //视频成功处理逻辑
* };
* sdk.vedioFail = function(){
* //视频失败处理逻辑
* };
* var videoAd = sdk.createRewardedVideoAd();
* videoAd.load().then(() => videoAd.show());
*
*/
createRewardedVideoAd
(){
let
self
=
this
;
if
(
cc
.
sys
.
platform
===
cc
.
sys
.
WECHAT_GAME
)
{
if
(
this
.
VideoAd
){
return
this
.
VideoAd
;
...
...
@@ -1347,6 +1359,22 @@ var sdk = {
this
.
VideoAd
.
onLoad
(
function
(
res
){
console
.
log
(
"sdk VideoAd广告加载事件:"
,
res
)
});
var
closeFun
=
function
(
res
){
// 用户点击了【关闭广告】按钮
// 小于 2.1.0 的基础库版本,res 是一个 undefined
if
(
res
&&
res
.
isEnded
||
res
===
undefined
)
{
console
.
log
(
"sdk 看视频成功"
);
self
.
videoSuccess
();
}
else
{
console
.
error
(
"sdk 看视频失败"
);
self
.
videoFail
();
}
};
this
.
VideoAd
.
onClose
(
closeFun
);
this
.
VideoAd
.
onError
(
function
(
res
){
//console.log("sdk VideoAd广告错误事件:", res)
wx
.
showToast
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment