- Home /
Question by
grimmy · Oct 13, 2011 at 11:36 AM ·
texturemovietexture
www.movie not playing?
I want to play a www movie on a 3dobject (a tv) once downloaded. The problem I'm having is that all I see on the object is the first frame of the movie. Nothing plays. Any ideas? This code is basically a cut and paste of this but replacing the guiTexture with a mesh (a plane).
var url = "http://www.unity3d.com/webplayers/Movie/sample.ogg";
var myScreen :GameObject;
function Awake()
{
myScreen=gameObject;
DontDestroyOnLoad(this);//temp
}
function Start () {
// Start download
var www = new WWW(url);
// Make sure the movie is ready to start before we start playing
var movieTexture :MovieTexture = www.movie;
myScreen.renderer.material.mainTexture= movieTexture;
while (!movieTexture.isReadyToPlay)
{
yield;
}
print("movie is ready to play!!");
// Assign clip to audio source
// Sync playback with audio
audio.clip = movieTexture.audioClip;
// Play both movie & sound
movieTexture.Play();
audio.Play();
}
Comment
Answer by grimmy · Oct 13, 2011 at 01:36 PM
I discovered the problem. A movie texture seems to automatically Stop playing whenever a new scene/level is loaded. To fix this I simply changed the Start() function to function OnLevelWasLoaded (). The movie plays fine.
Your answer
Follow this Question
Related Questions
Assigning UV Map to model at runtime 0 Answers
Animated GIF as a texture on Iphone 3 Answers
Movie Texture not updating 0 Answers
Web player: Possible to pass native tex ptr to another app? 0 Answers