Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Question How to Play Youtube Video in Unity Webgl

Discussion in 'Web' started by RahmatAli_Noob, Aug 23, 2023.

  1. RahmatAli_Noob


    Sep 13, 2022
    Hi Everyone, I am Making the WebGl project in Which I need to Play the YouTube Video.
    I have Checked Most of the Assets on the Unity Asset Store or on the google. Some of them Claims to Work But is not Working.
    I Have tried 2 Most Claiming assets.
    1 - This, they Claim that there assets work fine but It Didn't Work in both the free version or in purchase version.
    2- This, this is free Asset but Require the License key to check the Demo project and the Demo license key is not Working. Also I Have Contacted with their Team but there is no response from them Yet.

    I am Looking for this Solution about 2 Weeks Now.
    Is there Any Solution on Unity To play the YouTube Video In Webgl or Not?
    Thanks In Advance.
  2. jukka_j


    Unity Technologies

    May 4, 2018
    Unfortunately I am not aware of any mechanism that Google would allow YouTube videos to be embedded without the use of their video player widget. Their own supplied video player widget is Google's official solution that adheres to their embedding licensing rules.

    See how that would work on normal non-WebGL HTML pages.

    But unfortunately that video player widget does not support being embedded inside a 3D WebGL Canvas.

    Looking at the first asset store asset, they mention "webgl(chrome, firefox) use third party server to get the video urls". So what that means is that they work around Google's official video player widget by ripping the videos onto a transparent proxy server that they host somewhere.

    The second asset store package does not mention their details. I presume they will be doing something similar.

    Searching the web, it looks like developers of Google's Chrome web browser prototyped a solution for this six years ago, at . However running the code today does not work (and looks like it never worked in public Chrome, but only in their internal test builds). In they mention

    This project only worked with a locally-patched prototype version of Chromium, but we are no longer working on it. I don't think we will ever add this support in Chromium.

    It does seem like the video proxy solution from asset store package 1 would be the straightforward method, if the asset store package author can help make it work. But do check YouTube's licensing and ask the asset store package author about licensing to make sure the mechanism is adhering to YouTube's licensing.
  3. tylergregg


    Aug 6, 2012
    jukka_j and mgear like this.
  4. ontreus


    May 18, 2015
    Hi, I tested your example and the important thing is that it works in WEBGL, but could you create a simpler example. One without the player moving. Just a VideoPlayer
    Because I had difficulty replicating your model. When I tried, my video had no sound and was upside down. Thanks