小游戏视频播放出现JS错误
VideoUtil.playVideo = function (_callback) { var vv = this .loadXCXVideo(); SoundManage.pauseBGSound(); vv.onEnded( function () { console.log( "ended" ); }); vv.onTimeUpdate( function () { console.log( "onVideoTimeUpdate" ); }); vv.onPlay( function () { console.log( "onVideoPlay" ); }); }; VideoUtil.destroy = function (vv) { vv.destroy(); }; VideoUtil.loadXCXVideo = function () { var res = VideoUtil.systeminfo; var h = 368 / 640 * res.windowWidth; var videoparam = { "x" : 0, "y" : 100, "width" : res.windowWidth, "height" : h, "objectFit" : "contain" , "poster" : "//res.qiaomukeji.com/game/bangqiu/videobg.jpg" , "src" : "//res.qiaomukeji.com/game/bangqiu/bangqiuvideo.mp4" , "controls" : false , "autoplay" : true }; return window[ "wx" ].createVideo(videoparam); }; |
根据官方API文档创建书写,视频可正常播放,JS文件提示错误,无法正常走onEnded事件,错误截图如下: