iPhoneUtils.PlayMovie 播放影片
static function PlayMovie (path : string, bgColor : Color, controlMode : iPhoneMovieControlMode = iPhoneMovieControlMode.Full, scalingMode : iPhoneMovieScalingMode = iPhoneMovieScalingMode.AspectFit) : void
Description描述
Plays a full-screen movie. Note that player will stream movie directly from the iPhone disc, therefore you have to provide movie as a separate files and not as an usual asset.
播放一个全屏影片。注意播放器将从iPhone disc(iPhone唱片机)直接播放影片,因此你必须提供一个单独的文件而不是一个通常的资源。
You will have to create a folder named StreamingAssets inside your Unity project (inside your Assets folder). Store your movies inside that folder. Unity will automatically copy contents of that folder into the iPhone application bundle.
你必须在你的Unity工程(在你的Assets文件夹下)创建一个名为StreamingAssets的文件夹。在这个文件夹下储存你的电影。Unity将会自动复制文件夹下内容在你的iPhone应用程序下。
Calling this function will initiate a transition that fades the screen from your current content to the designated background color of the player. When playback finishes, the player uses another fade effect to transition back to your content.
调用这个方法将产生一个过渡,从你当前的屏幕上消失的内容到播放器指定的背景色。当播放完后,播放器使用另一个渐变效果转换回你的内容。
Calling this function will pause Unity during movie playback. When playback finishes Unity will resume.
调用这个函数将在播放影片期间暂停Unity,当播放完成Unity恢复。
iPhoneUtils.PlayMovie internally uses MPMoviePlayerController object to play movies. Therefore you should expect the same behavior and the same supported formats. MPMoviePlayerController supports any movie or audio files that already play correctly on an iPod or iPhone. For movie files, this typically means files with the extensions .mov, .mp4, .mpv, and .3gp and using one of the following compression standards:
iPhoneUtils.PlayMovie内部使用MPMoviePlayerController播放电影。 因此,你应该预期相同的行为和相同的支持的格式。MPMoviePlayerController支持任何已在iPod或苹果电脑上正常使用电影或音频文件。 对于电影文件,这往往意味着文件扩展名,.mp4 .mov,.mpv,.3gp和使用下列的压缩标准:
• H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps. Note that B frames are not supported in the Baseline profile.
H.264 Baseline Profile Level 3.0 video,在30 f/s 的情况下分辨率达到640×480像素。注意: 在Baseline profile下还不支持B frames
• MPEG-4 Part 2 video (Simple Profile)
你可以查找苹果的MPMoviePlayerController文档在这里:MPMoviePlayerController Class Reference
function Start() {
iPhoneUtils.PlayMovie("StarWars.mp4", Color.black, iPhoneMovieControlMode.CancelOnTouch);
}