Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Video Player component reference

Learn more about the settings of the Video Player component.
Read time 7 minutesLast updated 13 days ago

Configure the Video Player component's settings to specify the video file to play and customize its playback behavior within your scene.
For information about the Video Player component and how to create one, refer to Video Player component targets and Create a Video Player component.

Property

Description

SourceChoose the source type to retrieve your video content from. The source could be a video file that's stored in your project, hosted externally at a specific URL, or saved in your
StreamingAssets
folder.
Video ClipSelect the Video Clip to assign to the Video Player component. This isn’t supported on the Web platform.
URLEnter the URL (for example, http:// or file://) of the video you want to assign to the Video Player.
Update ModeSet the clock source that the Video Player component uses to update its timing. For more information, refer to Update Mode dropdown.
Play On AwakePlay the video when the Scene launches. Clear it if you want to trigger the video playback at another point during runtime. Trigger it via scripting with the
Play()
command.
Wait For First FrameWait for the first frame of the source video to be ready for display before playback starts. Clear it to keep the video time in sync with the rest of the game, which might cause the first few frames to be discarded.
LoopLoop the source video when it reaches its end. Clear it to stop playing the video when it reaches the end.
Skip On DropWhen you enable this option, and the Video Player component detects drift between the playback position and the game clock, the Video Player skips ahead. When you disable this option, the Video Player doesn't correct for drift and systematically plays all frames.
Playback SpeedSet a multiplier for the playback speed, as a value between 0 and 10. By default, this value is set to 1, which is the normal speed. If you set the field to 2, the video plays at two times its normal speed.
Render ModeChoose how the video will render. For more information, refer to Render Mode dropdown.
CameraDefine the Camera that receives the video. This property is available only when Render Mode is Camera Far Plane or Camera Near Plane.
AlphaSet the global transparency level to add to the source video. This property allows elements behind the plane to be visible through it. For more information about alpha channels, refer to video transparency support. This property is available only when Render Mode is Camera Far Plane or Camera Near Plane.
3D LayoutChoose the layout of 3D content in the source video. For more information, refer to 3D Layout dropdown.
Target TextureDefine the Render Texture where the Video Player component renders its images. For recommended settings for the Render Texture, refer to Prepare your Render Texture for video.
Aspect RatioSet the aspect ratio of the images that fill the Camera Near Plane, Camera Far Plane, or Render Texture when the corresponding Render Mode is used. For more information, refer to Aspect Ratio dropdown.
RendererSelect the Renderer where the Video Player component renders its images. When set to None, the Video Player component uses the Renderer on the same GameObject.
Auto-Select PropertyWhen you enable this option, the Video Player component selects the Renderer's main texture automatically. When you disable this option, you can set the Material Property option manually.
Audio Output ModeDefine how the source’s audio tracks are output. For more information, refer to Audio Output Mode dropdown.
Controlled TracksThe number of audio tracks in the video.

Only shown when Source is URL. When Source is Video Clip, the number of tracks is determined by examining the video file.
Track NumberEnable the associated audio track to use for playback. You need to set this property prior to playback.

The text to the left of the checkbox provides information about the audio track, specifically the track number, language, and number of channels.

When the source is a URL, this information is only available during playback.

This property only appears if your source is a Video Clip that has an audio track (or tracks), or your source is a URL (which lets you indicate how many tracks to expect from the URL during playback).
Audio SourceThe audio source through which the audio track plays. The targeted audio source can also play Audio Clips.

The audio source’s playback controls (
Play On Awake
and
Play()
in scripting API) don't apply to the video source’s audio track.

This property only appears when the Audio Output Mode is set to Audio Source.
MuteMute the associated audio track. In Audio Source mode, the audio source’s control is used.

This property is available only when Audio Output Mode is Direct.
VolumeVolume of the associated audio track. In Audio Source mode, the audio source’s volume is used.

This property is available only when Audio Output Mode is Direct.

Update Mode dropdown

The following options are available in the Update Mode dropdown.

Value

Description

DSP TimeUse the same clock source that processes audio.
Game TimeUse the same clock source as the game clock. This clock source is affected by the time scaling and capture frame rate settings.
Unscaled Game TimeUse the same clock source as the game clock but this clock source isn't affected by time scaling or capture frame rate.

Render Mode dropdown

The following options are available in the Render Mode dropdown. For further information about these targets, refer to Video Player component targets.

Value

Description

Camera Far PlaneRender the video on the Camera’s far plane. If you choose this option, the video plays in the background of the Scene.
Camera Near PlaneRender the video on the Camera’s near plane. If you choose this option, the video plays in front of the objects in your Scene.
Render TextureRender the video into a Render Texture. For instructions and recommended settings, refer to Set up your Render Texture to display video.
Material OverrideRender the video into a selected Texture property of a GameObject through its Renderer’s Material.
API OnlyRender the video into the VideoPlayer.texture Scripting API property.

3D Layout dropdown

The following options are available in the 3D Layout dropdown.

Value

Description

NoneVideo doesn't have any 3D content.
Side by SideVideo has 3D content where the left eye occupies the left half and right eye occupies the right half of video frames.
Over UnderVideo has 3D content where the left eye occupies the upper half and right eye occupies the lower half of video frames.

Aspect Ratio dropdown

The following settings are options available in the
Aspect Ratio

?

dropdown.

Value

Description

No ScalingUse no scaling. The video is centered on the destination rectangle.
Fit VerticallyScale the source to fit the destination rectangle vertically. This option crops the left and right sides or leaves black areas on each side if necessary. The source aspect ratio is preserved.
Fit HorizontallyScale the source to fit the destination rectangle horizontally. This option crops the top and bottom regions or leaves black areas above and below if needed. The source aspect ratio is preserved.
Fit InsideScale the source to fit the destination rectangle without having to crop. Leaves black areas on the left and right or above and below as needed. The source aspect ratio is preserved.
Fit OutsideScale the source to fit the destination rectangle without leaving black areas on the left and right or above and below, cropping as required. The source aspect ratio is preserved.
StretchScale both horizontally or vertically to fit the destination rectangle. The source aspect ratio isn't preserved.

Audio Output Mode dropdown

The following options are available in the Audio Output Mode dropdown.

Value

Description

NoneAudio isn't played.
Audio SourceAudio samples are sent to selected audio sources, enabling Unity’s audio processing to be applied.
DirectAudio samples are sent directly to the audio output hardware, bypassing Unity’s audio processing.
API Only (Experimental)Audio samples are sent to the associated AudioSampleProvider.

Additional resources