Hi guys!
So basically i tried to make a small game using Unity for android and when the player lose, it switches from the game scene to the Game Over scene and play a video on videoplayer.
The video is a 3min50s long video (don’t ask me why) in mp4, of 147Mo and 360*640 of dimensions.
It works well and is fluid (sometimes doesn’t appear tho but i read that it can happen…) but after about 30s it freezes, even the sound, but it’s not always exactly at the same moment (that’s why i don’t think it comes from the video).
And i can say that the game is still working cause i have my “Back to Menu” button that appeared after 1min like it is supposed to.
On Unity it works like a charm but i realised with time that lots of stuff works great on Unity but not on devices xD
I even made it easier for the app by putting the video in the preloaded assets just to be sure (sometimes it still doesnt appears…)
Here is the organisation of my Scene.
And here is my video player:`public RawImage rawImage;
public VideoPlayer videoPlayer;
public AudioSource audioSource;
// Start is called before the first frame update
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();
}`
Any idea?