头条录屏相关功能
iniTape(){this.tapePath =null;this.tapeStartTime =0;this.tapeMaxTime =90;this.recorder = tt.getGameRecorderManager();},onTapeButtonClick(){let nowTime =newDate().getTime();let tapeTime = nowTime -this.tapeStartTime;if(tapeTime <3000){
cc.log("录屏时间小于3秒");}else{this.stopTape();};},tapeTimeControl(){let timeCount =0;letcallback=function(){
timeCount++;if(timeCount >=this.tapeMaxTime){this.unschedule(callback);
timeCount =0;this.stopTape();};};this.schedule(callback,1);},startTape(){this.tapeStartTime =newDate().getTime();if(typeof(tt)!="undefined"){this.recorder.onStart(res =>{
console.log("录屏开始");this.tapeTimeControl();});this.recorder.start({
duration:this.tapeMaxTime,});};},stopTape(){if(typeof(tt)!="undefined"){this.recorder.onStop(res =>{
console.log(res.videoPath,"录屏结束");this.tapePath = res.videoPath;});this.recorder.stop();};},tapeShare(){if(typeof(tt)!=="undefined"){if(this.game_rules_js.tapePath ==null){return;};
tt.shareAppMessage({
channel:'video',
title:'标题',
extra:{
videoPath:this.game_rules_js.tapePath,
videoTopics:["话题1","话题2"]},
success:()=>{
console.log('录屏分享成功');this.tapeShareSucces();},
fail:()=>{
console.log('录屏分享失败',this.tapePath);this.tapeShareFail();}});};},
tapeShareSucces:function(){},
tapeShareFail:function(){},
发布评论