Hello,
I’m using a JScript attached to GameObject which contain one streamed MovieTexture and one AudioSource.
Movies are Ogg Theora + Vorbis formated and it works pretty good, except when movies reach the end.
In fact, the webplayer pluggin simply crashed and then come this message:
- “The content was stopped because a fatal content error has been detected”.
The strange things I noticed, are:
- The first video which reach the end, make the pluggin crash.
- The Pluggin don’t crash if I disable the Video Sound.
The first code:
/* Here is the JScript which manage a MovieScreen */
private var bool_video = 0;
private var video_width = Screen.width * 0.7;
private var video_height = Screen.height * 0.7;
private var close_height = Screen.height * 0.05;
private var movieTexture : MovieTexture;
private var rep_url = "http://localhost/videos/";
function load_movie(movie_to_load){
var www = new WWW(rep_url + movie_to_load);
while (![url]www.movie.isReadyToPlay[/url])
yield;
movieTexture = [url]www.movie;[/url]
audio.clip = movieTexture.audioClip;
transform.parent.renderer.material.mainTexture = movieTexture;
audio.loop = true;
movieTexture.loop = true;
audio.volume = 0;
movieTexture.Play();
audio.Play();
}
function OnMouseDown(){
if (movieTexture.isReadyToPlay){
bool_video = 1;
GameObject.Find("MainControler").GetComponent("camcontroler").enabled = false;
GameObject.Find("MainControler").SendMessage("boolcontrol_set");
GameObject.Find("AudioAmbiant").audio.Pause();
}
}
function OnGUI(){
if (bool_video == 1){
audio.volume = 0.6;
GUI.DrawTexture(Rect((Screen.width - video_width) / 2, (Screen.height - video_height) /2, video_width, video_height), transform.parent.renderer.material.mainTexture, ScaleMode.StretchToFill);
GUI.color = Color.red;
if(GUI.Button(Rect((Screen.width + video_width) / 2 - 1.2 *close_height, (Screen.height + video_height) / 2 - 1.2 * close_height, close_height, close_height), "X")){
GameObject.Find("MainControler").GetComponent("camcontroler").enabled = true;
GameObject.Find("MainControler").SendMessage("boolcontrol_set");
GameObject.Find("AudioAmbiant").audio.Play();
audio.volume = 0;
bool_video = 0;
}
}
}
The Second one:
/* Here is the Code which manage the Ambiant Sound */
private var audio_url = "http://localhost/videos/take_me_with_U.ogg";
private var default_audio : AudioClip;
function Start(){
var wwwaudio = new WWW(audio_url);
while (!wwwaudio.audioClip.isReadyToPlay)
yield;
default_audio = wwwaudio.audioClip;
gameObject.audio.clip = default_audio;
gameObject.audio.Play();
}
Thanks a lot for your help and advices.
PS: My english is so crap that I hope you even so can puzzle out my apologizes.