小游戏中视频播放出现js错误
发布于 6 年前 作者 tao94 14662 次浏览 来自 问答

this.videoplayer = wx.createVideo({

x: 0,

y: 0,

width: 500,

height: 500,

src: http://res.xxx.com/video/ba/87/ba8795747d96fee9d3e39e70d57a92fb.mp4,

autoplay: true

})

按照文档调用视频播放器,在微信开发者工具中,视频播放正常,只是会有JS错误出现:

VM132:1 appServiceSDKScriptError

Cannot read property ‘emitter’ of undefined;at api onVideoPause callback function

TypeError: Cannot read property ‘emitter’ of undefined

    at Function.<anonymous> (http://127.0.0.1:53293/game/__dev__/WAGame.js:13:4967)

    at http://127.0.0.1:53293/game/__dev__/WAGame.js:4:10697

    at a (http://127.0.0.1:53293/game/gamePage.html:1:38633)

    at d.registerCallback (http://127.0.0.1:53293/game/gamePage.html:1:38902)

    at m.forEach (http://127.0.0.1:53293/game/gamePage.html:1:36843)

    at Array.forEach (<anonymous>)

    at d (http://127.0.0.1:53293/game/gamePage.html:1:36823)

    at WebSocket.j.onmessage (http://127.0.0.1:53293/game/gamePage.html:1:36716)

console.error @ VM132:1

errorReport @ WAGame.js:3

(anonymous) @ WAGame.js:3

(anonymous) @ WAGame.js:4

a @ gamePage.html:1

d.registerCallback @ gamePage.html:1

m.forEach @ gamePage.html:1

d @ gamePage.html:1

j.onmessage @ gamePage.html:1

VM132:1 appServiceSDKScriptError

Cannot read property ‘emitter’ of undefined;at api onVideoEnded callback function

TypeError: Cannot read property ‘emitter’ of undefined

    at Function.<anonymous> (http://127.0.0.1:53293/game/__dev__/WAGame.js:13:4967)

    at http://127.0.0.1:53293/game/__dev__/WAGame.js:4:10697

    at a (http://127.0.0.1:53293/game/gamePage.html:1:38633)

    at d.registerCallback (http://127.0.0.1:53293/game/gamePage.html:1:38902)

    at m.forEach (http://127.0.0.1:53293/game/gamePage.html:1:36843)

    at Array.forEach (<anonymous>)

    at d (http://127.0.0.1:53293/game/gamePage.html:1:36823)

    at WebSocket.j.onmessage (http://127.0.0.1:53293/game/gamePage.html:1:36716)

请问是什么原因引起的这个问题,谢谢

3 回复

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

这里不是已经提示TypeError: Cannot read property ‘emitter’ of undefined?

您好,谢谢回复,小游戏视频播放的API没看到有emitter的定义资料,请问哪里有这方面的资料吗?

回到顶部