- Home /
GUI movie texture - sound delay
I play an .ogg video on a GUI movie texture. The video plays good. But the audio has a delay.
When I play the .ogg video separately it plays okay.
This is how i did. I created an empty gameobject. Then attached the script ( given below ) After that i assigned the audio source to the gameobject.
Script
var myMovie:MovieTexture ; var me :int; function Start() {
audio.clip = myMovie.audioClip;
audio.Play();
myMovie.Play();
}
function OnGUI() { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), myMovie); } function Update () { if(!myMovie.isPlaying || Input.GetKeyDown(KeyCode.Escape) ){ Application.LoadLevel(me); } }
help me with this script.
Any suggestions appreciated.
Answer by kolmich · Sep 23, 2012 at 09:15 AM
I had a problem where my audio was finishing 3 seconds before the end of the movie:
1) The length of my movie was 56 seconds. 2) I checked the length of the movie and the audio separately in unity by logging the Time.realTimeSinceStartUp and found out that the movie as well as the audio length are exactly 56 seconds. 3) I used vlc to extract the audio clip from the movie. The lenght of the extracted audio clip is 53 seconds!
4) I used Audacity to stretch the sound to 56 seconds and used instead the one imported by unity.
Now my sound and my oudio are running sync..
Hope this will help also resolving your problem.
Michal