Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Closepath | Filesystem path to the movie file. |
bgColor | Background color. |
controlMode | How the playback controls are to be displayed. |
scalingMode | How the movie is to be scaled to fit the screen. |
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.
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 Part 2 video (Simple Profile).
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); } }
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thanks for helping to make the Unity documentation better!