svga / SVGAPlayer-Web

Similar to Lottie. Render After Effects / Animate CC (Flash) animations natively on Android and iOS, Web. 使用 SVGAPlayer 在 Android、iOS、Web中播放 After Effects / Animate CC (Flash) 动画。
https://svga.io
Apache License 2.0
954 stars 239 forks source link

LayaboxPlayer在微信小游戏中报错 #34

Closed palgerrard closed 5 years ago

palgerrard commented 6 years ago

我试了一下,不在微信小游戏中,LayaboxPlayer可以正常。 但在微信小游戏下,加载二进制资源会报错:

const displayObject = new SVGA.LayaboxPlayer('http://127.0.0.1:8083/tests/samples/kingset.svga') displayObject.setFrame(0, 0, 750, 750); displayObject.zOrder = 100; Laya.stage.addChild(displayObject) 错误如下

VM383:1 TypeError: Function(...) is not a function at r (bundle.main.js:21424) at i.get (bundle.main.js:20759) at i.nNlU.i.resolve (bundle.main.js:20254) at i.nNlU.i.setup (bundle.main.js:20809) at i.nNlU.i.decode (bundle.main.js:20818) at Object.load_viaProto (bundle.main.js:21516) at XMLHttpRequest.nNlU.l.loadAssets.o.onloadend (bundle.main.js:21510) at XMLHttpRequest._triggerEvent (weapp-adapter.js? [sm]:1176) at Function.success (weapp-adapter.js? [sm]:1302) at Object.success (WAGame.js:4) console.error @ VM383:1 load_viaProto @ bundle.main.js:21521 nNlU.l.loadAssets.o.onloadend @ bundle.main.js:21510 _triggerEvent @ weapp-adapter.js? [sm]:1176 success @ weapp-adapter.js? [sm]:1302 (anonymous) @ WAGame.js:4 (anonymous) @ WAGame.js:7 s.emit @ WAGame.js:5 (anonymous) @ WAGame.js:7 (anonymous) @ WAGame.js:4 a @ gamePage.html:1 (anonymous) @ gamePage.html:1 b.emit @ gamePage.html:1 callback @ gamePage.html:1 setTimeout @ gamePage.html:1 (anonymous) @ WAGame.js:4 (anonymous) @ WAGame.js:3 setTimeout (async) setTimeout @ WAGame.js:3 n @ gamePage.html:1 c @ gamePage.html:1 v.onreadystatechange @ gamePage.html:1 XMLHttpRequest.send (async) q @ gamePage.html:1 createRequestTask @ gamePage.html:1 invoke @ gamePage.html:1 r @ WAGame.js:4 c @ WAGame.js:4 r @ WAGame.js:7 e @ WAGame.js:7 (anonymous) @ WAGame.js:7 (anonymous) @ WAGame.js:6 send @ weapp-adapter.js? [sm]:1262 loadAssets @ bundle.main.js:21511 nNlU.e.exports @ bundle.main.js:21569 value @ bundle.main.js:20647 value @ bundle.main.js:20645 t @ bundle.main.js:22198 onready @ bundle.main.js:5742 (anonymous) @ bundle.main.js:12528 (anonymous) @ bundle.main.js:12619 push.LaBT.e.run @ async.node_modules.js:21233 push.LaBT.i.event @ async.node_modules.js:21187 push.LaBT.a.setScreenSize @ async.node_modules.js:25671 push.LaBT.a._changeCanvasSize @ async.node_modules.js:25644 e.run @ async.node_modules.js:23621 push.LaBT.n._update @ async.node_modules.js:23566 push.LaBT.a.render @ async.node_modules.js:25690 laya.display.Stage.render @ async.node_modules.js:28781 push.LaBT.a._loop @ async.node_modules.js:25679 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 s @ async.node_modules.js:22452 requestAnimationFrame (async) wxRequestAnimationFrame @ gamePage.html:18 e @ async.node_modules.js:22453 push.LaBT.i.init @ async.node_modules.js:21160 push.cn1Y.Director.initStage @ async.node_modules.js:34902 initStage @ bundle.main.js:260 init @ bundle.main.js:5657 _execJump @ async.node_modules.js:52539 (anonymous) @ async.node_modules.js:52509 (anonymous) @ WAGame.js:4 (anonymous) @ WAGame.js:3 setTimeout (async) setTimeout @ WAGame.js:3 _hashChangeHandler @ async.node_modules.js:52507 replaceTo @ async.node_modules.js:52592 jumpTo @ async.node_modules.js:52560 (anonymous) @ bundle.main.js:6443 onready @ bundle.main.js:24436 action @ bundle.main.js:22822 (anonymous) @ bundle.main.js:22833 Promise resolved (async) success @ bundle.main.js:22832 (anonymous) @ WAGame.js:4 u @ WAGame.js:4 (anonymous) @ WAGame.js:4 s @ gamePage.html:1 invoke @ gamePage.html:1 r @ WAGame.js:4 c @ WAGame.js:4 u @ WAGame.js:9 (anonymous) @ WAGame.js:6 process @ bundle.main.js:22830 init @ bundle.main.js:24421 ERIh @ bundle.main.js:6442 __webpack_require @ bundle.main.js:84 checkDeferredModules @ bundle.main.js:46 /CGf.Object.defineProperty.value @ bundle.main.js:221 (anonymous) @ bundle.main.js:224 require @ WAGame.js:3 (anonymous) @ WAGame.js:3 (anonymous) @ main.js? [sm]:4 require @ WAGame.js:3 (anonymous) @ WAGame.js:3 (anonymous) @ game.js? [sm]:3 require @ WAGame.js:3 (anonymous) @ gamePage.html:133 VM383:1 gameThirdScriptError Function(...) is not a function;at api request success callback function TypeError: Function(...) is not a function at r (http://127.0.0.1:32203/game/js/dist/bundle.main.js:21424:30) at i.get (http://127.0.0.1:32203/game/js/dist/bundle.main.js:20759:72) at i.nNlU.i.resolve (http://127.0.0.1:32203/game/js/dist/bundle.main.js:20254:191) at i.nNlU.i.setup (http://127.0.0.1:32203/game/js/dist/bundle.main.js:20809:37) at i.nNlU.i.decode (http://127.0.0.1:32203/game/js/dist/bundle.main.js:20818:19) at Object.load_viaProto (http://127.0.0.1:32203/game/js/dist/bundle.main.js:21516:21) at XMLHttpRequest.nNlU.l.loadAssets.o.onloadend (http://127.0.0.1:32203/game/js/dist/bundle.main.js:21510:15) at XMLHttpRequest._triggerEvent (http://127.0.0.1:32203/game/js/libs/weapp-adapter.js:1392:22) at Function.success (http://127.0.0.1:32203/game/js/libs/weapp-adapter.js:1517:22) at Object.success (http://127.0.0.1:32203/game/dev__/WAGame.js:4:3592)

palgerrard commented 6 years ago

定位到具体代码是load完资源后,在decode的过程中,generateConstructor,里面return Function(t)();这里面。Function在微信的底层库WAGame.js被重写了,里面的实现有问题。

PonyCui commented 6 years ago

应该是不支持微信小游戏的