Search Unity

Video Video Rotates On Load

Discussion in 'Audio & Video' started by gaglabs, Dec 5, 2019.

  1. gaglabs

    gaglabs

    Joined:
    Oct 17, 2019
    Posts:
    26
    I have a video that pulls from Firebase. When its uploaded and played via firebase, its rotation is correct. When its pulled from firebase into unity it looks likes this.



    when its played it changes its rotation to this..

    \

    any idea why its doing this.. this is my code..


    this sets the orientation
    Code (CSharp):
    1.  
    2.                 _imageBod.SetActive(false);
    3.                 topFitter.SetActive(true);
    4.                 bottomFitter.SetActive(true);
    5.                 VideoBody.enabled = true;
    6.                 ImageBody.preserveAspect = true;
    7.                
    8.                 float _imageWidth = 800;
    9.                 float _imageHeight = (float)_feed.MeidaHeight;
    10.              
    11.              
    12.                 VideoRect.sizeDelta = new Vector2(_imageWidth, _imageHeight);
    13.  
    after its loaded i call this..

    Code (CSharp):
    1. private IEnumerator OnLoadVideo()
    2.         {
    3.             string _url = LoadedFeed.VideoURL;
    4.            
    5.             if (!string.IsNullOrEmpty(LoadedFeed.ImageURL))
    6.             {
    7.                 UnityWebRequest www = UnityWebRequestTexture.GetTexture(LoadedFeed.ImageURL);
    8.                 yield return www.SendWebRequest();
    9.  
    10.                 if (www.isNetworkError || www.isHttpError)
    11.                 {
    12.                  
    13.                 }
    14.                 else
    15.                 {
    16.                     Texture2D _texture = ((DownloadHandlerTexture)www.downloadHandler).texture;
    17.                     VideoBody.texture = _texture;
    18.                    
    19.                 }
    20.             }
    21.  
    22.             if (!AppManager.APP_SETTINGS.UseOriginVideoFile)
    23.             {
    24.                 _url = string.Empty;
    25.                 bool _isGettedUrl = false;
    26.                 string _tempUrl = string.Empty;
    27.                 AppManager.FIREBASE_CONTROLLER.GetFeedVideoFileUrl(LoadedFeed.VideoFileName, (_gettedUrl =>
    28.                 {
    29.                     _isGettedUrl = true;
    30.                     _tempUrl = _gettedUrl;
    31.                 }));
    32.                 while (!_isGettedUrl)
    33.                 {
    34.                     yield return null;
    35.                 }
    36.                 _url = _tempUrl;
    37.             }
    38.  
    39.             if (!string.IsNullOrEmpty(_url))
    40.             {
    41.                 VPlayer.url = _url;
    42.                 VPlayer.Prepare();
    43.                 while (!VPlayer.isPrepared)
    44.                 {
    45.                     yield return null;
    46.                 }
    47.                 ShowPlayBtn();
    48.             }
    49.         }
    50.  
     
  2. gaglabs

    gaglabs

    Joined:
    Oct 17, 2019
    Posts:
    26
unityunity