- Home /
Unity Movie Texture Audio Black Screen
Hello,
Sorry for horrible title but I didn't know what else to call it. So using the code below I was able to stream a video with sound. However, with sound the first second or two are cut off. Why? When I do not have the sound from the video, the video plays perfectly in its entirety.
using UnityEngine;
using System.Collections;
public class IntroVideo : MonoBehaviour {
//Variables
public MovieTexture Intro;
public AudioSource audiodata;
WWW videodata;
// Use this for initialization
void Start () {
videodata = new WWW("http://redlightlife.tk/Videos/IntroVideo.ogv");
Intro = videodata.movie;
audiodata = this.GetComponent<AudioSource>();
audiodata.clip = Intro.audioClip;
}
// Update is called once per frame
void OnGUI () {
if (Intro.isReadyToPlay && !Intro.isPlaying)
{
Intro.Play();
audiodata.Play();
}
GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),Intro,ScaleMode.StretchToFill, false, 0.0f);
}
}
I'm having the same issue; on several devices when playing a $$anonymous$$ovieTexture after a refresh, the movie is black while the audio plays. Seems to occur only on $$anonymous$$ac. Has anyone found a solution to this? Using Unity 4.2.2f2
Answer by mr-sambarlow · Jan 12, 2015 at 11:16 AM
Just putting this here in case anyone is searching for answers (as I was!)
I had a similar issue where I was getting a few seconds of black screen whenever I played a movie. I switched to using ffmpeg2theora to convert my movies to OGV before brining into Unity -- and the issue went away.