小游戏视频播放出现JS错误
发布于 6 年前 作者 pingdai 8917 次浏览 来自 问答
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事件,错误截图如下:

2 回复

我一直出这个报错,不管controls怎么设置,求解!

video标签controls = false 之后就会出现此错误

回到顶部