- Home /
Audio lag/loop after weplayer gets focus again
Hi,
I encoutered a problem with the audio of a ogv video, focusing on a webplayer build: After loading and while playback an external ogv file I call the MovieTexture.Stop() method. Now the video
stopped and i don´t hear any audio...fine. After switching to my OS (Win) or another running application and
coming back to the webbrowser, you can listen to the problem, unity is perfoming a permanent audio loop, when
there should be silence.
To test my problem i set up a very simple test scene: Create a Plane, attach an audio source to it and also the following script:
private var intro: MovieTexture;
private var showIntro = false;
private var url_intro = "Intro_Video.ogv";
function Start(){
// ---------- VIDEO -------------- //
// Start download
if(!intro){
var www:WWW;
if ((Application.platform == RuntimePlatform.OSXWebPlayer) || (Application.platform == RuntimePlatform.WindowsWebPlayer)) {
www = new WWW(Application.dataPath + "/video/" + url_intro);
}
else www = new WWW ("file://" + Application.dataPath + "/video/" + url_intro);
// Make sure the movie is ready to start before we start playing
intro = www.movie;
while (!intro.isReadyToPlay)
yield;
// Assign clip to audio source
audio.clip = intro.audioClip;
}
// Sync playback with audio
if (intro && !intro.isPlaying){
intro.Play();
audio.Play();
}
showIntro = true;
}
function OnMouseUp () {
intro.Stop();
}
make sure to position the plane in front of the camera so that you can click on it. make a webplayer build. create a subfolder called "video" and put some ogv in that folder. rename the ogv to
"Intro_Video.ogv" for success with loading the external file. with a click on the plane you stop the video (and audio).
Is it a bug or am I doing something wrong?
Answer by Fabse · Jul 27, 2011 at 09:24 AM
Thanks a lot for just not answering. I decided to post my problem here, because this place is called "unity anwers". Well... in fact i had to wait since may 30th... looking every week for an answer....until today i downloaded the new version. Without changing anythig it works now. So it was a bug and it is fixed now. Thanks again for no answer.
Your answer
Follow this Question
Related Questions
Audio Lag Between Multiple Listeners 0 Answers
Prevent Unity Web Player from seizing the focus. 1 Answer
Playing Audio clip in loop 2 Answers
Sound Cracks or Lags on ZTE Blade? 0 Answers