WWW.movie 影片

var movie : MovieTexture

Description描述

Returns a MovieTexture generated from the downloaded data (Read Only).

从下载的数据,返回一个MovieTexture(只读)。

The data must be a movie in Ogg Theora format.

数据必须为一个Ogg Theora格式影片。

Theora是开放而且免费的视频压缩编码技术,由Xiph基金会发布。做为该基金会Ogg项目的一部分,从VP3 HD高清到MPEG-4/DiVX格式都能够被Theora很好的支持。 使用Theora无需任何专利许可费。Firefox和Opera将通过新的HTML5元素提供

了对Ogg/Theora视频的原生支持。

通过Directshow filters或FFdshow,可以在Windows平台使用它,VLC和mplayer均支持Theora视频的播放。

Even if the movie is not yet completely downloaded, this returns immediately, allowing you to start playing the partial movie as it downloads.

即使影片仍没有下载完成,也立即返回,允许你开始播放已经下载完成的部分。

var url = "http://www.unity3d.com/webplayers/Movie/sample.ogg";
function Start () {
	// Start download
	//开始下载
	var www = new WWW(url);

	// Make sure the movie is ready to start before we start playing
	//在我们开始播放之前,确保影片可以准备开始
	var movieTexture = www.movie;
	while (!movieTexture.isReadyToPlay)
	yield;

	// Initialize gui texture to be 1:1 resolution centered on screen
	//初始化GUI界面纹理到1:1分辨率,在屏幕的中心
	guiTexture.texture = movieTexture;

	transform.localScale = Vector3(0,0,0);
	transform.position = Vector3(0.5,0.5,0);
	guiTexture.pixelInset.xMin = -movieTexture.width / 2;
	guiTexture.pixelInset.xMax = movieTexture.width / 2;
	guiTexture.pixelInset.yMin = -movieTexture.height / 2;
	guiTexture.pixelInset.yMax = movieTexture.height / 2;

	// 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
//确保我们有GUI界面纹理和音频源
@script RequireComponent (GUITexture)
@script RequireComponent (AudioSource)
Page last updated: 2011-4-25