Search Unity

VideoPlayer authorization header

Discussion in 'Multiplayer' started by erwol, May 25, 2017.

  1. erwol

    erwol

    Joined:
    May 7, 2017
    Posts:
    2
    Hello,

    With Unity 5.6+ version we don't have www.Movie anymore as it has been deprecated. It also looks like the UnityWebRequest doesn't support video streaming neither. In brief, as far as I understood, the only way to stream video now is with the VideoPlayer component. And after digging the docs I couldn't find any API method or example showing how to add an HTTP header when using an url as video source. The server where the media I'm serving to my users lives needs an Authorization header so right now there's no way for me to stream videos into my application.

    Did someone face this situation? Any ideas?

    Thanks,
    Ernesto.
     
  2. erwol

    erwol

    Joined:
    May 7, 2017
    Posts:
    2
    Edit:
    I made this little script to check is basic in-url auth could wor and well, it looks like it's not supported. To make i clear I tried to load the video by formatting the url like: https://user:mail@url.domain.
    Code (csharp):
    1.  
    2. string protocol = "http://";
    3.         string auth = Email + ":" + Password + "@";
    4.         if (url.StartsWith("http://"))
    5.             url = url.Substring("http://".Length);
    6.  
    7.         else if (url.StartsWith("https://"))
    8.         {
    9.             url.Substring("https://".Length);
    10.             protocol = "https://";
    11.         }
    12.         else
    13.             Debug.LogError("Unexpected : " + url);
    14.  
    15.         url = protocol + WWW.EscapeURL(auth) + url;
    16.         Debug.Log("Final url: " + url);
    17.         return url;
    18.  
     
  3. sotokangr

    sotokangr

    Joined:
    Jun 3, 2010
    Posts:
    25
    Hello everyone,
    is there any solution to this yet?
    I am facing the same problem!
     
  4. jnroesch

    jnroesch

    Joined:
    Feb 2, 2018
    Posts:
    6
    I have the same issue.

    As mentioned above, Basic authentication with http does not seem to be supported in the Videoplayer component.

    You can use a auth Header from script to query your Server and for example get audiofiles back with the www.GetAudioClip() or www.GetMovieTexture() however they currently have no method like www.GetVideoClip() and as Long as that is the case authentication by URL is not going to be available.

    There was another Forum post where someone asked when www.getVideoClip() will be available but I think None of the unity representatives gave an answer.
     
  5. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    782