Search Unity

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

Discussion in 'Web' started by Wils, Jun 29, 2017.

  1. Wils

    Wils

    Joined:
    Dec 4, 2012
    Posts:
    6
    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.
     
    Last edited: Jun 29, 2017
    RmStriker17 likes this.
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    It might be worth trying with 5.6.1
     
  3. Julien-Lynge

    Julien-Lynge

    Joined:
    Nov 5, 2010
    Posts:
    142
    Can confirm this is still an issue with 2017.2.

    File is mp4 wrapped, imported with basically default settings.
     
  4. Julien-Lynge

    Julien-Lynge

    Joined:
    Nov 5, 2010
    Posts:
    142
    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.
    upload_2017-9-27_15-23-49.png

    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
     
  5. CalebBarton

    CalebBarton

    Joined:
    Jun 24, 2017
    Posts:
    4
    "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
     
    Last edited: Oct 3, 2017
  6. RmStriker17

    RmStriker17

    Joined:
    Mar 14, 2017
    Posts:
    2
    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.

     
  7. Julien-Lynge

    Julien-Lynge

    Joined:
    Nov 5, 2010
    Posts:
    142
    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.
     
  8. Babi_mc

    Babi_mc

    Joined:
    Apr 5, 2018
    Posts:
    5
    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
     
  9. CCouto96

    CCouto96

    Joined:
    May 18, 2016
    Posts:
    44
    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?
     
  10. Coopervr

    Coopervr

    Joined:
    Mar 24, 2020
    Posts:
    5
    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!
     
  11. SeanWebber

    SeanWebber

    Joined:
    Jun 17, 2020
    Posts:
    6
    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.
     
  12. JuanJSAR

    JuanJSAR

    Joined:
    Feb 21, 2014
    Posts:
    47
    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

    Code (CSharp):
    1.     public string folderName = "Videos";
    2.     public string fileName = "";
    3.     public string fileFormat = ".mp4";
    4.     public VideoPlayer videoPlayer;
    5.  
    6.     void Start()
    7.     {
    8.         videoPlayer.source = VideoSource.Url;
    9.         string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, folderName + System.IO.Path.DirectorySeparatorChar + fileName + fileFormat);
    10.         videoPlayer.url = filePath;
    11.     }
     
  13. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    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.
     
    JuanJSAR likes this.
  14. VirtualPierogi

    VirtualPierogi

    Joined:
    Sep 3, 2012
    Posts:
    54
    [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?
     
  15. sumpfkraut

    sumpfkraut

    Joined:
    Jan 18, 2013
    Posts:
    242
    System.IO.Path.Combine() works with WebGL?
    I thought System.IO is not supported.

    i would replace this line with
    Code (CSharp):
    1. videoPlayer.url = Application.streamingAssetsPath + "/myvideofile.mp4";
     
  16. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    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?
     
  17. Thunderkilll

    Thunderkilll

    Joined:
    Oct 30, 2018
    Posts:
    9
    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
     
  18. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
  19. Thunderkilll

    Thunderkilll

    Joined:
    Oct 30, 2018
    Posts:
    9
    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 .???
     
  20. Marks4

    Marks4

    Joined:
    Feb 25, 2018
    Posts:
    547
    WebRTC is not covered by any of my assets. I suggest you look into this plugin instead.