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?