using System.Collections;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Video;
|
|
|
|
public class videoToUI : MonoBehaviour
|
|
{
|
|
public RawImage rawImage;
|
|
public VideoPlayer videoPlayer;
|
|
|
|
void Start()
|
|
{
|
|
StartCoroutine(PlayVideo());
|
|
}
|
|
|
|
IEnumerator PlayVideo()
|
|
{
|
|
videoPlayer.Prepare();
|
|
WaitForSeconds waitForSeconds = new WaitForSeconds(1);
|
|
while (!videoPlayer.isPrepared)
|
|
{
|
|
yield return waitForSeconds;
|
|
break;
|
|
}
|
|
rawImage.texture = videoPlayer.texture;
|
|
videoPlayer.Play();
|
|
}
|
|
}
|