PlayFullScreenMovie(string, Color, FullScreenMovieControlMode, FullScreenMovieScalingMode)
Plays a full-screen movie.
Read time 2 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public static bool PlayFullScreenMovie(string path, Color bgColor, FullScreenMovieControlMode controlMode, FullScreenMovieScalingMode scalingMode)
Parameters
Filesystem path to the movie file.
Background color.
How the playback controls are to be displayed.
How the movie is to be scaled to fit the screen.
Returns
Type | Description |
|---|---|
| bool | true if the movie playback starts successfully, and false otherwise. On iOS, this method always returns true because playback starts asynchronously. |
Remarks
The Player streams the movie directly from device storage. It's recommended to provide the movie as a separate file, not as a usual asset. Create a folder named in the Assets folder of your Unity project to store your movie files. Unity automatically copies contents of that folder into the application bundle.
StreamingAssetsCalling this function will pause Unity during movie playback. Unity resumes after the playback finishes.
The first parameter can be a network-based URL. The function detects it by looking for a substring that follows the protocol name.
path://iOS: internally uses object to play movies. Therefore, you should expect the same behavior and the same supported formats. supports any movie or audio files that already play correctly on an iPod or iPhone.
Handheld.PlayFullScreenMovieAVPlayerViewControllerAVPlayerViewControllerThe movie files with .mov, .mp4, .mpv, and .3gp extensions and using one of the following compression standards are supported:
- 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 Part 2 video (Simple Profile).
Calling this function initiates 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.
For more information, refer to Apple's documentation on AVPlayerViewController class reference.
UWP: On Universal Windows Platform, internally uses XAML MediaElement control.
Handheld.PlayFullScreenMovieOn Universal Windows Platform, there generally isn't a movie resolution or bitrate limit, however, higher resolution or bitrate movies consume more memory for decoding. Weaker devices also start skipping frames much sooner at extremely high resolutions. To find a list of supported formats for this platform, refer to the Microsoft documentation on Supported audio and video formats (Windows Runtime apps).
Android: When an Android phone is in standby mode, function pauses the movie playback. When the phone is turned back on, the movie playback resumes over the lock screen if you're using a developement build. You have the option to switch back to the standard lock screen display.
Handheld.PlayFullScreenMovieExamples
using System.Collections;using System.Collections.Generic;using UnityEngine;public class Example : MonoBehaviour{ void Start() { Handheld.PlayFullScreenMovie("StarWars.mp4", Color.black, FullScreenMovieControlMode.CancelOnInput); }}