- Home /
Question by
corentindedu · Oct 17, 2019 at 08:18 AM ·
scenevideocrashingapplication
The application crashes when it loads the video
Hi,
My application works perfectly on my computer but it crashes when I export it to my phone.
I noticed that it stops when I change scenes and that it has to upload a video.
Here is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;
public class VideoStream : MonoBehaviour{
public RawImage rawImage;
public VideoPlayer videoPlayer;
public AudioSource audioSource;
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();
audioSource.Play();
}
}
Do you have an answer please
Comment