Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video API in WeChatBrowser(x5 engine) can't render? #5418

Closed
luvsta opened this issue Nov 30, 2020 · 5 comments
Closed

Video API in WeChatBrowser(x5 engine) can't render? #5418

luvsta opened this issue Nov 30, 2020 · 5 comments

Comments

@luvsta
Copy link

luvsta commented Nov 30, 2020

Version

  • Phaser Version: 3.23.0 - 3.24.1
  • Operating system:iOS 12-14
  • Browser:WeChat Browser ( x5 engine )

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抛出异常

@photonstorm
Copy link
Collaborator

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)

@jcyuan
Copy link
Contributor

jcyuan commented Dec 3, 2020

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.

@photonstorm
Copy link
Collaborator

Useful info, thanks!

@luvsta
Copy link
Author

luvsta commented Dec 5, 2020

@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.

@luvsta
Copy link
Author

luvsta commented Dec 5, 2020

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants