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

Videos do not render in Firefox on Android #4213

Closed
brianpeiris opened this issue May 1, 2021 · 12 comments
Closed

Videos do not render in Firefox on Android #4213

brianpeiris opened this issue May 1, 2021 · 12 comments
Assignees

Comments

@brianpeiris
Copy link
Contributor

brianpeiris commented May 1, 2021

Description
Videos seem to play, but do not actually render in Firefox on Android. They just display as a black rectangle. This appears to be the case with all video formats.

To Reproduce
Steps to reproduce the behavior:

  1. Use Firefox on Android
  2. Create a room
  3. Add a video to it, like https://brianpeiris.github.io/test-media/big-buck-bunny-360p-short.mp4
  4. See that the video does not render

Expected behavior
Videos should render in Firefox on Android!

Hardware

  • Device: Phone
  • OS: Android
  • Browser: Firefox

┆Issue is synchronized with this Jira Task

@brianpeiris brianpeiris added bug needs triage For bugs that have not yet been assigned a fix priority P2 Address when able P1 Address as quickly as possible and removed needs triage For bugs that have not yet been assigned a fix priority P2 Address when able labels May 1, 2021
@takahirox
Copy link
Contributor

Oh... this is a serious problem. I would take this ticket unless someone already started to tackle it.

@takahirox takahirox self-assigned this May 3, 2021
@takahirox
Copy link
Contributor

I confirmed the issue. I reproduced this problem on Android Firefox Nightly version 90.0a1 on Samsung Galaxy S8+. And also confirmed the videos play on Android Chrome.

@takahirox
Copy link
Contributor

takahirox commented May 3, 2021

I did remote debugging and saw the CORS error on Android Firefox Nightly.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://hubs.mozilla.com/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

But I also see this error Android Chrome, Desktop Chrome, and Desktop Firefox but videos play on them. I guess Android Firefox CORS is more restricted? I'll keep investigating more...

Update: I talked to @netpro2k about the CORS error but the error may be unrelated to video stuffs.

@takahirox
Copy link
Contributor

takahirox commented May 5, 2021

TLDR: The current Android Firefox seems to have a problem to upload video (mp4, webm, and maybe other formats except for ogv) to texture with gl.texImage2D(). I will report it to bugzilla.


As I wrote in #4224 (comment), the CORS error doesn't seem to be related to the video play problem.

I investigated the problem again and found the following error messages in the console with remote debugging.

WebGL warning: tex(Sub)Image[23]D: Resource has no data (yet?). Uploading zeros. threejs-allocation-patches.js:9:8
WebGL warning: drawElementsInstanced: Tex image TEXTURE_2D level 0 is incurring lazy initialization. three.module.js:16782:5

I first thought the messages were originally caused by the CORS error but as I mentioned the CORS error doesn't seem to be related the video problem. So it seems to simply fail to upload the video data to texture with gl.texImage2D().

I sought simpler examples on which I can reproduce the problem and found the Three.js examples.

https://threejs.org/examples/webgl_video_kinect.html

In this example, I see the same texImage2D() errors. An interesting thing is a video plays in materials video example

https://threejs.org/examples/webgl_materials_video.html

The reason why the video plays seems the format is ogv. The former one uses mp4 and webm.

(The latter example requires a user gesture first while the former one doesn't, so I first thought the reason can be the user gesture but the former one still couldn't play the video even though I added a user gesture request.)

I tried to place ogv video in Hubs room and it plays on Android Firefox.

So my conclusion is the current Android Firefox seems to have a problem to upload video (mp4, webm, and maybe other formats except for ogv) to texture with gl.texImage2D(). I will report it to bugzilla tomorrow and also push Firefox team internally.

If it will take time to resolve this problem, we might want to convert videos to ogv for Android Firefox on the fly as workaround if possible.

@takahirox
Copy link
Contributor

I reported the problem to Android Firefox mozilla-mobile/fenix#19399

@brianpeiris
Copy link
Contributor Author

brianpeiris commented May 5, 2021

I can confirm that the webgl_materials_video example breaks in Firefox Android if you only include the sintel.mp4 video file.

@takahirox
Copy link
Contributor

takahirox commented May 5, 2021

Yeah, I confirmed that too. ogv video texture seems to work fine even on the current Android Firefox so perhaps workaround we can do on our ends so far may be using ogv.

@brianpeiris
Copy link
Contributor Author

Also confirmed the issue with this simpler webgl video test, just to make sure it wasn't specific to three.js. https://webglsamples.org/video/video.html

I think using ogv is not viable since it would not be feasible to convert video on the fly at scale.

@takahirox
Copy link
Contributor

I made a minimal test reproducing the problem and shared it with Android Firefox and Geckoview teams.

https://takahirox.github.io/texImage2D-gl-test/index.html

it would not be feasible to convert video on the fly at scale.

Yeah, it isn't probably a good option. But I couldn't come up with any other workarounds for now.

The best solution is the problem will be fixed on Android Firefox end. I will try to work closely to Android Firefox and Geckoview teams.

@brianpeiris
Copy link
Contributor Author

Sounds great. Thanks Takahiro!

@brianpeiris
Copy link
Contributor Author

The Fenix bug was migrated to https://bugzilla.mozilla.org/show_bug.cgi?id=1709726

@brianpeiris
Copy link
Contributor Author

I actually cannot reproduce this anymore on my Galaxy S21 with Firefox 99.

I'm not sure why it's working in Hubs, because some of the test cases here still fail to work in Firefox. So there is probably still a bug in Firefox, but we seemed to have worked around it somehow. Perhaps a three.js update fixed it for us.

I'll close this, because I'm pretty sure Hubs is not affected anymore, but feel free to re-open someone else can repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants