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

[WebGL] AVPPlayerClose produces error MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED #504

Closed
jarruda opened this issue Oct 21, 2020 · 1 comment
Closed
Assignees
Labels
enhancement 🚀 New feature or request WebGL WebGL platform
Milestone

Comments

@jarruda
Copy link

jarruda commented Oct 21, 2020

Describe the bug
When the AVPPlayerClose method is invoked in the jslib plugin for WebGL, it sets the src attribute of the Video element to an empty string and invokes the load method on it to release the resources for the element.

This action results in the onerror handler being invoked with the error MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED, which invokes console.log with the error. This behavior has been observed in Chrome, at least.

The HTML standard recommends removing the src attribute and invoking load instead of setting it to an empty string. We've applied this change to our codebase and it appears to work well.

Your Setup (please complete the following information):

  • Unity version: 2018.4.25f1
  • AVPro Video version: [AVProVideo] Initialising AVPro Video (script v1.11.4 plugin v1.9.17) on ANGLE (Intel(R) UHD Graphics 620 Direct3D11 vs_5_0 ps_5_0)/OpenGL ES 3.0 (WebGL 2.0) (MT False) on WebGLPlayer Windows 10
  • Operating system version: ^
  • Device model: ^
  • Video specs (resolution, frame-rate, codec, file size): n/a

To Reproduce

  1. Load WebGL player into Chrome browser.
  2. Load a video into a MediaPlayer.
  3. Destroy the MediaPlayer
  4. Observe log.

Logs

Error: video not supported (errorcode=4) color:red;

Patch:

        // Setting 'src' to an empty string results in the onerror handler being invoked and producing log noise on Chrome.
        // Removing the src attribute and invoking load is a recommended best practice in the HTML Standard.
        // See https://html.spec.whatwg.org/multipage/media.html#best-practices-for-authors-using-media-elements
        vid.pause();
        vid.removeAttribute("src"); // Previous: vid.src = "";
        vid.load();
@MorrisRH MorrisRH added enhancement 🚀 New feature or request WebGL WebGL platform labels Oct 22, 2020
@AndrewRH AndrewRH added this to the 2.1.0 milestone Mar 9, 2021
@AndrewRH AndrewRH self-assigned this Mar 9, 2021
@AndrewRH
Copy link
Contributor

AndrewRH commented Mar 9, 2021

Thanks @jarruda for this great suggestion - we will roll this into the next release.

@AndrewRH AndrewRH closed this as completed Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🚀 New feature or request WebGL WebGL platform
Projects
None yet
Development

No branches or pull requests

3 participants