[code=javascript]
public var url="file:///c:/sample.ogg";
function Start ()
{
url="file:///" + Application.dataPath + "/video/sample.ogg";
print(url);
// Start download
var www = new WWW(url);
// Make sure the movie is ready to start before we start playing
var movieTexture = www.movie;
print("downloading...");
while (!movieTexture.isReadyToPlay)
{
print(www.progress);
yield;
}
print("download complete");
print(www.url);
// Initialize gui texture to be 1:1 resolution centered on screen
guiTexture.texture = movieTexture;
// Assign clip to audio source
// Sync playback with audio
audio.clip = movieTexture.audioClip;
// Play both movie & sound
movieTexture.Play();
audio.Play();
}
// Make sure we have gui texture and audio source
@script RequireComponent (GUITexture)
@script RequireComponent (AudioSource) [/code]