- Home /
Android MP4 Video Playback
Hello world! I'm having problems playing a video on a scene I'm doing. The scene only plays the video and then jump to another scene. All I need is the scene to play a video in an android device, still, I don't know what I'm doing wrong, but there's no video the camera shows the skybox and jumps to the next scene instantly. (The video is in the assets folder, named "Intro.mp4" and the script is attached to an empty).
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class VideoController : MonoBehaviour {
void Start () {
StartCoroutine(PlayMovie());
}
private IEnumerator PlayMovie() {
Handheld.PlayFullScreenMovie("Intro.mp4", Color.black, FullScreenMovieControlMode.Full, FullScreenMovieScalingMode.AspectFill);
yield return new WaitForEndOfFrame();
yield return new WaitForEndOfFrame();
SceneManager.LoadScene("MainGUI");
}
}
I am having the same problem. Seems to happen on Adreno devices only.
Answer by HarshadK · Jun 16, 2016 at 08:43 AM
From the Handheld.PlayFullScreenMovie documentation page:
You will have to create a folder named StreamingAssets inside your Unity project (inside your Assets folder). Store your movies inside that folder. Unity will automatically copy contents of that folder into the application bundle.
So you need to store the video in a folder named StreamingAssets
.
The video is already in Strea$$anonymous$$gAssets for me. I have just tried to one more line " yield return new WaitForEndOfFrame();" and it doesn't crash the first time on Adreno devices. Then it crashes again with an OpenGL error.
Answer by tonyarabish · Oct 25, 2018 at 06:29 AM
Convert any other unsupported WMV, MKV, FLV, MOV, MP4, WTV, etc to any Android product supported video formats.https://www.avdshare.com/convert-avi-to-android-supported-video-formats
Your answer
Follow this Question
Related Questions
How to display a video behind gui on mobile 2 Answers
Handheld.PlayFullScreenMovie memory leak? 1 Answer
onControllerHide() crash 0 Answers
Programmatically changing brightness setting on Android using c# 0 Answers
Unity3d Get Cube Pressed On Mobile 1 Answer