x


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();

}

more ▼

asked Oct 13 '11 at 11:36 AM

grimmy gravatar image

grimmy
302 23 34 43

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Oct 13 '11 at 01:36 PM

grimmy gravatar image

grimmy
302 23 34 43

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2203
x107

asked: Oct 13 '11 at 11:36 AM

Seen: 613 times

Last Updated: Oct 13 '11 at 01:36 PM