|
@@ -207,16 +207,17 @@ export class SdkUtil {
|
|
|
call_back(true)
|
|
|
}
|
|
|
}
|
|
|
- // public static shareGame(title: string, imageUrl: string, videoPath: string) {
|
|
|
- // if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
|
|
|
- // if(videoPath!="") {
|
|
|
- // // this.ttShareScreenRecordVideo(config.gameName,videoPath)
|
|
|
- // }
|
|
|
- // } else if(sys.platform == sys.Platform.WECHAT_GAME) {
|
|
|
- // title = title + '好刺激、好好玩'
|
|
|
- // // this.wxShare(title, imageUrl)
|
|
|
- // }
|
|
|
- // }
|
|
|
+ public static shareGameVideo() {
|
|
|
+ if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
|
|
|
+ let videoPath = SdkUtil.ttGetScreenRecordingVideoPath()
|
|
|
+ uiManager.Instance().showLoading()
|
|
|
+ this.ttShareScreenRecordVideo(config.gameName,videoPath,()=>{
|
|
|
+ uiManager.Instance().hideLoading()
|
|
|
+ }, ()=>{
|
|
|
+ uiManager.Instance().hideLoading()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 获取广告id
|
|
|
public static getAdId(ad_type = config.ADS_TYPE.UNKNOWN):string {
|
|
@@ -265,17 +266,19 @@ export class SdkUtil {
|
|
|
console.log("广告加载完成");
|
|
|
});
|
|
|
SdkUtil.videoAd.onClose((res) => {
|
|
|
- call_back(res)
|
|
|
+ // console.log('广告关闭')
|
|
|
+ uiManager.Instance().hideLoading()
|
|
|
SdkUtil.isLookAd = false
|
|
|
SdkUtil.videoAd.destroy()
|
|
|
- uiManager.Instance().hideLoading()
|
|
|
+ call_back(res)
|
|
|
});
|
|
|
SdkUtil.videoAd.onError((res) => {
|
|
|
- let errorString = res.errCode + '-' + res.errMsg
|
|
|
- call_back({isEnded:false,errorString:errorString})
|
|
|
+ // console.log('广告错误')
|
|
|
+ uiManager.Instance().hideLoading()
|
|
|
SdkUtil.isLookAd = false
|
|
|
SdkUtil.videoAd.destroy()
|
|
|
- uiManager.Instance().hideLoading()
|
|
|
+ let errorString = res.errCode + '-' + res.errMsg
|
|
|
+ call_back({isEnded:false,errorString:errorString})
|
|
|
});
|
|
|
SdkUtil.videoAd.load()
|
|
|
}
|
|
@@ -463,26 +466,30 @@ export class SdkUtil {
|
|
|
|
|
|
// 抖音分享屏幕录制视频
|
|
|
private static ttShareScreenRecordVideo(title: string, videoPath: string, onSuccess: Function = null, onFail: Function = null) {
|
|
|
- // tt.shareAppMessage({
|
|
|
- // title: title,
|
|
|
- // templateId: config.TT_SHARE_TEMPLATEID,
|
|
|
- // channel: "video",
|
|
|
- // extra: {
|
|
|
- // videoTopics: [config.gameName],
|
|
|
- // hashtag_list: ['小游戏','小程序'],
|
|
|
- // videoPath: videoPath,
|
|
|
- // withVideoId: true,
|
|
|
- // },
|
|
|
- // success: (res) => {
|
|
|
- // console.log('抖音分享屏幕录制视频,成功=',res)
|
|
|
- // onSuccess && onSuccess();
|
|
|
- // },
|
|
|
- // fail: (e) => {
|
|
|
- // // 当前今日头条ios无法获得分享成功回调 if(res.platform === 'ios' && res.appName === 'Toutiao')
|
|
|
- // console.log('抖音分享屏幕录制视频,失败=',e)
|
|
|
- // onFail && onFail()
|
|
|
- // }
|
|
|
- // })
|
|
|
+ console.log('tt_录制视频路径=',videoPath)
|
|
|
+ if(videoPath.length<=0) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ tt.shareAppMessage({
|
|
|
+ title: title,
|
|
|
+ templateId: config.TT_CONFIG.SHARE_RECORD_VIDEO_ID,
|
|
|
+ channel: "video",
|
|
|
+ extra: {
|
|
|
+ videoTopics: [config.gameName],
|
|
|
+ hashtag_list: ['小游戏','小程序'],
|
|
|
+ videoPath: videoPath,
|
|
|
+ withVideoId: true,
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ console.log('抖音分享屏幕录制视频,成功=',res)
|
|
|
+ onSuccess && onSuccess();
|
|
|
+ },
|
|
|
+ fail: (e) => {
|
|
|
+ // 当前今日头条ios无法获得分享成功回调 if(res.platform === 'ios' && res.appName === 'Toutiao')
|
|
|
+ console.log('抖音分享屏幕录制视频,失败=',e)
|
|
|
+ onFail && onFail()
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
}
|