Search Unity

Video [Android] 360 VR Video black screen first while playing in background

Discussion in 'Audio & Video' started by Dighim, Apr 24, 2019.

  1. Dighim

    Dighim

    Joined:
    Apr 10, 2019
    Posts:
    4
    Hello !

    I'm working on a project where the user is within a 360 video playing on skybox. The problem is that I've made the video prepare and then play on prepare completed. Still, even with a preload of shader applied to video, the video starts to play before actually rendering (I can see my GUI appearing before I can actually see the video playing, while it's activating the same time as my video based on script).

    Here is my piece of code for synchronizing my video, GUI and animation :

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Video;
    3.  
    4. public class StartAnimOnTime : MonoBehaviour
    5. {
    6.     [SerializeField]
    7.     private VideoPlayer videoPlayer;
    8.     [SerializeField]
    9.     private Animator animator;
    10.     [SerializeField]
    11.     private GameObject canvas;
    12.  
    13.     void Awake()
    14.     {
    15.         videoPlayer.prepareCompleted += StartVideo;
    16.         videoPlayer.started += startAnim;
    17.     }
    18.  
    19.     private void Start()
    20.     {
    21.         videoPlayer.Prepare();
    22.     }
    23.  
    24.     private void StartVideo(VideoPlayer source)
    25.     {
    26.         Debug.Log("START VIDEO");
    27.         source.Play();
    28.     }
    29.  
    30.     private void startAnim(VideoPlayer source)
    31.     {
    32.         canvas.SetActive(true);
    33.         animator.SetFloat("Speed", 1);
    34.     }
    35. }
    36.  
    Thanks for the reply !

    Dighim
     
  2. Dighim

    Dighim

    Joined:
    Apr 10, 2019
    Posts:
    4
    Forgot to mention that this problem only happens on Android (maybe Stand-alone too), in Editor mode everything is smooth and I can see the video starting at the right time