- Home /
Play movie in full screen
Hello,
I have a video I exported into HD format .mp4. I am trying to call it using this code, however, it never shows in the game. The portion of this code that does work is the sound pausing part.
using UnityEngine;
using System.Collections;
public class IntroVideo : MonoBehaviour {
//Variables
public MovieTexture Video;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void OnGUI () {
Video.Play();
GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),Video,ScaleMode.StretchToFill, false, 0.0f);
if (Video.isPlaying)
{
audio.Stop();
}
}
}
Does it not show in the editor or the final build? What is the target platform? Dont call PLAY from OnGUI(), this gets called 2 or more times per frame, that will result in a black(null looking) image....call it once in Start() ins$$anonymous$$d. Also you tell the audio to stop playing if the video isPlaying...it seems like you would want the audio to stop once !Video.isPlaying
Yes I do have unity pro. It also does not play the video in teh inspector window. It does however play the sound. I called audio.stop because I have other audio background music playing that I would like to stop. I know to stop the audio of the actual movie it is Video.audio.stop. Or something like that.
Answer by WesleyDonk · Jan 18, 2013 at 10:39 AM
I also had this problem a week ago.. My problem was the movie itself.. A .mov movie works well. So I am now avoiding .MP4