- Home /
Getting a youtube vid , applying it as a texture to a gameobject and playing it with sound
function YoutubePlay(){
// Start download var youtoobMuvee = new WWW(youtubeString);
// Make sure the movie is ready to start before we start playing var movieTexture = youtoobMuvee.movie; while (!movieTexture.isReadyToPlay) yield;
funkBox.renderer.material.mainTexture=movieTexture; audio.clip = movieTexture.audioClip;
// Play both movie & sound funkBox.renderer.material.mainTexture.Play(); audio.Play(); }
Getting a youtube vid , applying it as a texture to a gameobject and playing it with sound doesnt work , i am getting these errors
!texture.texture
UnityEngine.MovieTexture:get_isReadyToPlay()
UnityEngine.MovieTexture:get_isReadyToPlay()
failed to create 2D texture
UnityEngine.MovieTexture:get_isReadyToPlay()
UnityEngine.MovieTexture:get_isReadyToPlay()
what am i doing wrong here?
Answer by Cyb3rManiak · Aug 14, 2010 at 05:36 PM
You can't stream videos from YouTube, since they are not in OGG format (Ogg Vorbis Theora)...
From the Unity Manual: (Link to manual)
The data must be a movie in Ogg Theora format.
Answer by Whimsical · Aug 14, 2010 at 07:09 PM
You need to write your own decoder, THEN it's possible.