Play a video in the first scene

Hi! I’m new to Unity and need help with the first scene of my game. I have a video which displays a logo and I want it to be played when the first scene starts, just like the unity splash screen. I would like to know the code to do so. I’m using Unity Personal 2.5.2, but I would also like to know the code to do the same in Unity 5.6.6. Basically, I would like to know the code to add in the start and update loops below. Thanks.


`
using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.SceneManagement;

public class DisplayLogo : MonoBehaviour

{
public string nextScene;

void Start()  
{
    /* Play the video until it finishes and.  
        change the scene to ‘nextScene’  
        after the video completes. */
}

void Update()
{
    /* If the mouse button is clicked or any key is
       pressed, stop playing the video and skip  
       directly to the scene ‘nextScene’. */
}

}
`

Okay, I wrote the code myself after doing some experiments. Too bad nobody helped at all :(. Anyway, here’s the code to do this:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Video;
using UnityEngine.SceneManagement;
    
public class PlayVideo : Monobehaviour {

   public string nextScene;
   public VideoPlayer video;
   public Float videoDuration;
       
   void Start() {
      video.Prepare();
      StartCoroutine(“PlayVideo”);
   }
    
   void Update() {
      if (Input.anyKey && video.isPlaying)
      {
          video.Stop();
          SceneManager.LoadScene(nextScene);
      }
   }
    
   public IEnumerator PlayVideo()
   {
       yield return new WaitUntil(() => video.isPrepared);
       video.Play();
       yield return new WaitForSeconds(videoDuration);
       video.Stop();
       SceneManager.LoadScene(nextScene);
   }
}