Version: 2021.2
言語: 日本語
public static bool PlayFullScreenMovie (string path, Color bgColor= Color.black, FullScreenMovieControlMode controlMode= FullScreenMovieControlMode.Full, FullScreenMovieScalingMode scalingMode= FullScreenMovieScalingMode.AspectFit);

パラメーター

path 動画ファイルへのファイルシステムパス
bgColor 背景色
controlMode 再生コントロールの表示方法
scalingMode 画面に合わせて動画を拡大、縮小する方法

説明

動画をフルスクリーンで再生します

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.

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

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.

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.

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

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.

MPEG-4 パート 2 動画(シンプルプロファイル)

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

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.

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

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 1920x1080. For these platforms, you can find list of supported formats here: Supported audio and video formats on Windows Store

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Example : MonoBehaviour { void Start() { Handheld.PlayFullScreenMovie("StarWars.mp4", Color.black, FullScreenMovieControlMode.CancelOnInput); } }