Unity WebGL VideoPlayer not working - No decoders for requested formats: video/x-ms-wmv

Hi,

I am having a problem with playing Video on WebGL on Firefox. My Unity version is 5.6.0f3. I am playing the video from URL, but when it doesn’t work, and the warning I am getting is

Cannot play media. No decoders for requested formats: video/x-ms-wmv

Any help would be appreciated, thanks.

1 Like

It might be worth trying with 5.6.1

Can confirm this is still an issue with 2017.2.

File is mp4 wrapped, imported with basically default settings.

Update: changing transcoding from h264 to vp8 removes the error message, but the video still doesn’t play. Tried various transcoding settings in Unity, no change. Tried uGUI (via RawImage) using a render texture, and quad in scene using material override.

Tried encoding video file using h264 with premiere (had previously tried w/ VLC).

Screenshot of tests included. Right side is UI element, left is quad, both trying and failing to play video.

Console output is below - this test was in Firefox. Seeing same thing in Edge.

Successfully compiled asm.js code (total compilation time 4ms; not stored in cache (too small to benefit)) UnityLoader.js
Successfully compiled asm.js code (total compilation time 1ms; not stored in cache (too small to benefit)) UnityLoader.js
You can reduce your startup time if you configure your web server to host .unityweb files using gzip compression. UnityLoader.js:4:8480
Successfully compiled asm.js code (total compilation time 3557ms; stored in cache) af326789-094e-4338-8667-e9748d62592f
unreachable code after return statement[Learn More] c53625cd-850b-45fe-9f29-60710f10c234:2:4519
Initialize engine version: 2017.2.0f1 (35e55a2a85de)
c53625cd-850b-45fe-9f29-60710f10c234:2:174198
Creating WebGL 2.0 context. UnityLoader.js:1:7731
Renderer: Mozilla
c53625cd-850b-45fe-9f29-60710f10c234:2:174198
Vendor: Mozilla
c53625cd-850b-45fe-9f29-60710f10c234:2:174198
Version: OpenGL ES 3.0 (WebGL 2.0)
c53625cd-850b-45fe-9f29-60710f10c234:2:174198
GLES: 3
c53625cd-850b-45fe-9f29-60710f10c234:2:174198
EXT_color_buffer_float GL_EXT_color_buffer_float EXT_texture_filter_anisotropic GL_EXT_texture_filter_anisotropic EXT_disjoint_timer_query GL_EXT_disjoint_timer_query OES_texture_float_linear GL_OES_texture_float_linear WEBGL_compressed_texture_s3tc GL_WEBGL_compressed_texture_s3tc WEBGL_debug_renderer_info GL_WEBGL_debug_renderer_info WEBGL_lose_context GL_WEBGL_lose_context MOZ_WEBGL_lose_context GL_MOZ_WEBGL_lose_context MOZ_WEBGL_compressed_texture_s3tc GL_MOZ_WEBGL_compressed_texture_s3tc
c53625cd-850b-45fe-9f29-60710f10c234:2:174198
OPENGL LOG: Creating OpenGL ES 3.0 graphics device ; Context level <OpenGL ES 3.0> ; Context handle 1
c53625cd-850b-45fe-9f29-60710f10c234:2:174198
UnloadTime: 0.835000 ms
c53625cd-850b-45fe-9f29-60710f10c234:2:174198
Cannot play media. No decoders for requested formats: video/x-ms-wmv, video/x-ms-wmv, video/x-ms-wmv, video/x-ms-wmv

“Cannot play media. No decoders for requested formats: video/x-ms-wmv, video/x-ms-wmv, video/x-ms-wmv, video/x-ms-wmv”

I have the exact same problem. h.264 encoded video plays during editor, but not build.

Both URL and in-game video does this. Using 2017.1.1f1, tested on firefox and chrome

Hi Julien! It’s Ricky. I’m having the same issue ;(
When I open the game as an app from my desktop it works great. But when running my game through WebGL the game play runs ok however the video doesn’t work. I get same error as OP.

Hey folks,
Just FYI, we did eventually get this working using h.264 and pointing at a URL instead of embedding the media in the WebGL app. Sounds like other folks are having other issues, but it’s at least worth a try.

Can some one explain how you got this working please!
Do not know how to do:
“using h.264 and pointing at a URL instead of embedding the media in the WebGL app”

Thank you in advance.

Cheers

Been having the same problem! My video clip works in the editor, but when I build a WebGl and open it, no video plays. I have tried using URL’s, VideoClips with Material Override and Render Texture and nothing has worked! I know with URLs you need an absolute path, but I don’t know where to upload my videos to get that URL path. Then there were some mentions of using script to find the video, but I am not really a programmer.

Does anyone have any idea on what to do?

I know this is old. But, I still had the same issue so someone else might find this solution:

I used AWS to host it, followed their tutorial on activating AWS as CORS configuration and hosting a video. But, now I’m streaming from URL via webgl upload to itch.io.

I hope this helps someone else. So much relief. Took 5 minutes to implement the solution!

Did you ever find a solution to this? Having the same issue at the moment. Using the absolute path of a video file stored in a folder within my home directory seems to crash Unity.

the correct thing is that the developers of unity will find a solution for this problem
Sadly, it cannot be solved without knowing how to program …

  • To convert the video into “H264” in a simple and free way I use “handbrake”
  • The video that results from the conversion, I put it in the folder “StreamingAssets” inside the “Unity”
  • To play the videos I use the following line of code
    public string folderName = "Videos";
    public string fileName = "";
    public string fileFormat = ".mp4";
    public VideoPlayer videoPlayer;

    void Start()
    {
        videoPlayer.source = VideoSource.Url;
        string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, folderName + System.IO.Path.DirectorySeparatorChar + fileName + fileFormat);
        videoPlayer.url = filePath;
    }

Thanks for a comprehensive example @JuanJSAR . Currently Unity web builds do not indeed work properly for embedding video files. There is a bug report about that in our database, and unsure about what to do about it, because embedding video files in a build as assets is usually not the thing that people would want to do.

That is, it is much better to place videos in StreamingAssets because that way the game can start up already without needing to first download the video. If the video is placed in regular assets, it will cause the whole video to be downloaded in full before the game can start up at all.

1 Like

[Unity 2020.2.5] Used the method from @JuanJSAR . Im putting the videos in the streaming assets folder and while it works in the editor it breaks when played through the firefox browser even when run directly with build and run. Error reads: No way to decode the file video/mp4.
What gives?

System.IO.Path.Combine() works with WebGL?
I thought System.IO is not supported.

i would replace this line with

videoPlayer.url = Application.streamingAssetsPath + "/myvideofile.mp4";

Decoding the video is a task that is the browser’s responsibility. According to https://caniuse.com/mpeg4 . The error suggests that Firefox could not find a codec for the video type on the installed OS, or something similar. Do other browsers work?

please sir it doesn’t work even in other browsers even chrome I used the same setup why won’t a simple vodeo work I added a button so I can start and stop it no hope

@Thunderkilll I developed an asset that can play videos on webgl.

thank you man it is good since you know about it then how can I retrieve camera feed in webgl and send it with webRTC can you help me with that please .???

WebRTC is not covered by any of my assets. I suggest you look into this plugin instead.