Search Unity

Question WebGL Video API - SOLVED

Discussion in 'Audio & Video' started by Spazio_h_ART, Nov 25, 2021.

  1. Spazio_h_ART

    Spazio_h_ART

    Joined:
    Jan 19, 2021
    Posts:
    7
    Hello people, I really need your help.
    Since august I'm struggling with the VideoPlayer of Unity: I'm using the WebGL platform, and I need to play videos on the walls [cube], for example like you're walking in a floor and see a video on a TV on the walls, do you copy? Perfect.
    Since I can't play a video from a local URL of my PC, YouTube, Vimeo, Mega, Dropbox or any other video platform I know, I discovered that I need to upload the video to an API, right? [The Unity customer service told me so]. I tried some services, like Cloudinary, but they didnt' work.
    Now the question I would like to submit to you: WHERE do I upload my video to make it play in my [holy d**n f*****g] WebGL project?
    Thank you and sorry for the bad language.
     
  2. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    It depends why it did not work. Since I assume you are running it in a web page, you may have to deal with things like Content Security Policies to allow a different domain name for the videos on your web server. (This is security protection against hackers.) If you open say Developer Tools (from menu) in Chrome, open up Console and look at the Networking tab. What errors (if any) do you see there? That might help identify the cause of the problem. Is it trying to fetch the video URL but failing? If so, what is the error? (Unauthorized? Not found? CSP violation? etc)
     
  3. Spazio_h_ART

    Spazio_h_ART

    Joined:
    Jan 19, 2021
    Posts:
    7
    It's a Unity error, it's like it doesn't find the URL. For example, if I link an URL of a video on commondatastorage.googleapis it works, for any other URL I use, nisba, not even a single frame playing
     
  4. Serge_Billault

    Serge_Billault

    Joined:
    Aug 26, 2014
    Posts:
    190
    Even if you are not using it personnaly, you should at least always display a message that indicate to the user what kind of problem related to the video there is, so that he might have a chance to correct it (be it cross-domain problems and whatnot). But in this case, you could also benefit from it since you dont seem to know what the problem might be althought Unity always report every single error it encountered while trying to fetch the video.

    For exemple, in this online démo (no installation needed) : https://geoarcmap.alwaysdata.net/VINTAGE_TV
    you will know what the problem is if you enter the URL of the non working video in the video URL input field. That said, the message itself sometimes has to be designed by you based on an error code, in my case I for exemple lazily translated a "ressource not found" error code into "Cannot read file" which you should not imitate.
     
  5. Spazio_h_ART

    Spazio_h_ART

    Joined:
    Jan 19, 2021
    Posts:
    7
    Guys, my main problem is that I don't know WHERE to host a video that can be linked on Unity. I'm a freaking noob, I don't know anything about errors, of any kind. Please, tell me just where to load the video.
     
  6. Serge_Billault

    Serge_Billault

    Joined:
    Aug 26, 2014
    Posts:
    190
    There are free servers that can provide you free storage space (but limited) for your content. Or you can host the videos on your own server. But either way, I'm afraid you will have to learn a bit of how to configure a server, or at least about CORS if you want to filter acess to your videos. I'm at AlwaysData but it took me a full day before having something up and running (I had zero knowledge about server hosting, when they threw at me my admin ssh key I tried to decide if it was edible or if it was for putting on the chimney). You can try Amazon, or Google, but I think you need to pay for their hosting services.
     
    Last edited: Dec 10, 2021
  7. Spazio_h_ART

    Spazio_h_ART

    Joined:
    Jan 19, 2021
    Posts:
    7
    Thanks for all your messages and help! I resolved using Cloudinary platform to upload the video and then link it in the URL section of the VideoPlayer in Unity.
     
  8. GaboFacil3D

    GaboFacil3D

    Joined:
    Jan 15, 2020
    Posts:
    19
    Hola podrias ayudarme o explicarme como usaste Cloudinary para generar las url para el videoplayer en unity