- 最后登录
- 2017-5-15
- 注册时间
- 2012-3-1
- 阅读权限
- 90
- 积分
- 32973
  
- 纳金币
- 32806
- 精华
- 12
|
#pragma strict
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 sourcek
//指定剪辑到音频源
// 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)
对视频的格式有着一定的要求 *.ogg
|
|