返回介绍

Handheld.PlayFullScreenMovie 播放全屏电影

发布于 2019-12-18 15:37:50 字数 5221 浏览 1310 评论 0 收藏 0

JavaScript => public static function PlayFullScreenMovie(path: string, bgColor: Color = Color.black, controlMode: FullScreenMovieControlMode = FullScreenMovieControlMode.Full, scalingMode: FullScreenMovieScalingMode = FullScreenMovieScalingMode.AspectFit): bool;
C# => public static bool PlayFullScreenMovie(string path, Color bgColor = Color.black, FullScreenMovieControlMode controlMode = FullScreenMovieControlMode.Full, FullScreenMovieScalingMode scalingMode = FullScreenMovieScalingMode.AspectFit);

Parameters 参数

pathFilesystem path to the movie file.
bgColorBackground color.
controlModeHow the playback controls are to be displayed.
scalingModeHow the movie is to be scaled to fit the screen.

Description 描述

Plays a full-screen movie.

播放全屏电影。

Note that player will stream movie directly from the device storage, therefore you have to provide movie as a separate files and not as a usual asset. 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 application bundle.

注意该播放器将会直接从设备存储电影流,因此你必须提供单独文件的电影而不是通常的资源包。你必须在你的Unity工程文件下创建一个名为StreamingAssets文件夹(在你的Assets文件夹下)。存储你的电影到该文件里。Unity将会自动拷贝该文件夹到应用程序包。

Calling this function will pause Unity during movie playback. When playback finishes Unity will .

调用该函数将会在电影播放期间暂停Unity。当播放结束Unity将会恢复运行。

The first parameter, path, can be a network-based URL. The function will detect that by looking for a “: / /” substring that follows the protocol name.

首个参数,路径,可以是基于网络的URL地址。该函数会检测并寻找“: / /“协议名称后面的子字符串。

On iOS, Handheld.PlayFullScreenMovie 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.

在iOS上,Handheld.PlayFullScreenMovie内部使用MPMoviePlayerController 对象去播放电影。因此,你应该期望相同的行为和相同的支持格式。MPMoviePlayerController支持任何已经在当前的iPod 或者iPhone上播放过的电影或者音频文件。

For movie files, this typically means files with the extensions .mov, .mp4, .mpv, and .3gp and using one of the following compression standards:

对于电影文件,这通常意味着文件扩展名.mov,.mp4,.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.

高达 640 x 480,30 帧每秒的 H.264 基线配置文件水平 3.0 视频。请注意,B 帧中的基线配置文件不支持。

MPEG-4 Part 2 video (Simple Profile).

MPEG-4 第二部分视频 (简单配置文件)。

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.

调用该函数将会开始一个屏幕渐变的过渡,从你当前的内容转变为指定播放器的背景颜色。当播放结束,播放器使用另一个渐变效果过渡返回到你之前的内容。

You can find Apple's MPMoviePlayerController documentation here: MPMoviePlayerController Class Reference

你可以从 MPMoviePlayerController Class Reference找到应用的MPMoviePlayerController 证明文件。

On Windows Phone 8, Handheld.PlayFullScreenMovie internally uses Microsoft Media Foundation for movie playback. On this platform, calling Handheld.PlayFullScreenMovie with full or minimal control mode is not supported.

在Windows Phone 8上,Handheld.PlayFullScreenMovie内部使用Microsoft 基础多媒体播放电影。在该平台上,调用Handheld.PlayFullScreenMovie,不支持完全或最小的控制模式。

On Windows Store Apps and Windows Phone 8.1, Handheld.PlayFullScreenMovie internally uses XAML MediaElement control.

在Windows 应用商城和Windows Phone 8.1上,Handheld.PlayFullScreenMovie内部使用XAML MediaElement控制。

On Windows Phone and Windows Store Apps, there generally isn't movie resolution or bitrate limit, however, higher resolution or bitrate movies will consume more memory for decoding. Weaker devices will also start skipping frames much sooner at extremely high resolutions. For example, Nokia Lumia 620 can only play videos smoothly up to 1920×1080. For these platforms, you can find list of supported formats here: Supported audio and video formats on Windows Store

在Windows手机和Windows应用商城中,一般没有电影分辨率或比特率限制,但是高分辨率、比特率解码的电影会消耗更多的内存。较弱的设备还会在高分辨率时更早的开始跳帧。例如,诺基亚Lumia 620 1920 x1080只能播放流畅模式的视频。在其他平台,你可以从 Supported audio and video formats on Windows Store寻找支持的格式列表。

JavaScript:

function Start () {
		Handheld.PlayFullScreenMovie ("StarWars.mp4", Color.black, FullScreenMovieControlMode.CancelOnInput);
	}

C#:

	function Start () {
		Handheld.PlayFullScreenMovie ("StarWars.mp4", Color.black, FullScreenMovieControlMode.CancelOnInput);
	}

handheld

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文