Phaser: Video API in WeChatBrowser(x5 engine) can't render?

Created on 30 Nov 2020  ·  5Comments  ·  Source: photonstorm/phaser

Version

Description

When I use Video API in Wechat Browser, the console remind me "TypeError: null is not an object (evaluating 'this.frame.realWidth')"
When I check 'Phaser.scene.cache.video' ,it shows that Map Struct's size is 0.
On the contrary, it’s available in PC Chrome and Mobile Phone Browser, the video rendered successfully and the Map Struct's size is 1.
See additional information for details.

Example Test Code


load : this.load.video('key','url',true,false)

scene: this.add.video(0,0,'key');

Additional Information


PC console:
pc console
ios console:
iOS抛出异常

🎞 Video 🐛 3rd Party Lib Bug

Most helpful comment

Are you sure this is a video format that WeChat is capable of playing? have you tested the video outside of Phaser? (like in a simple HTML video component)

i'm familiar with this platform, it's not a fault of Phaser, because Phaser loads video with <video> tag in VideoFile loader type, but this tag is just not available on this platform. to create a video on this platform, there is its private API: wx.createVideo(...);

@luvsta if you wanna do this, you have to customize your own loader filetypes (https://github.com/photonstorm/phaser/blob/master/src/loader/filetypes/VideoFile.js FYI), and register it into the file manager:

FileTypesManager.register('wxVideo', ...... {  this.addFile(new YourOwnFileType(...));  });

but to be honest, i'm not sure if the low-layer of this platform allows you to access the graphic context of the video, you could have a try.

All 5 comments

Are you sure this is a video format that WeChat is capable of playing? have you tested the video outside of Phaser? (like in a simple HTML video component)

Are you sure this is a video format that WeChat is capable of playing? have you tested the video outside of Phaser? (like in a simple HTML video component)

i'm familiar with this platform, it's not a fault of Phaser, because Phaser loads video with <video> tag in VideoFile loader type, but this tag is just not available on this platform. to create a video on this platform, there is its private API: wx.createVideo(...);

@luvsta if you wanna do this, you have to customize your own loader filetypes (https://github.com/photonstorm/phaser/blob/master/src/loader/filetypes/VideoFile.js FYI), and register it into the file manager:

FileTypesManager.register('wxVideo', ...... {  this.addFile(new YourOwnFileType(...));  });

but to be honest, i'm not sure if the low-layer of this platform allows you to access the graphic context of the video, you could have a try.

Useful info, thanks!

@jcyuan thx bro,I realized that the WeChat browser was blocking the load event,and i fixed that using 'wx-js-sdk' ,wrapping code behavior as user behavior.

@photonstorm Yes, I found out later that it was a browser limitation

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarkSky picture MarkSky  ·  3Comments

sercand picture sercand  ·  3Comments

samme picture samme  ·  4Comments

lilijreey picture lilijreey  ·  4Comments

Legomite picture Legomite  ·  4Comments