Documentation

Support

Unity Studio

Open Unity Studio

Unity Studio

Video Player component

Add videos to your GameObject with a Video Player component.
Read time 1 minuteLast updated 4 hours ago

Use the Video Player component to display video content from a file or from the web directly on the surface of an object. The following are example objects you can display video on in your scene:
  • TV screens
  • Mobile phones and tablets
  • Cinemas and theatre screens
  • Digital billboards and jumbotron screens
  • Security camera feeds
  • Car infotainment screens
  • Monitors
When you move the object that contains this video, the video moves with it within the scene. If the user moves away from the video, they might miss important content. For videos that overlay the screen as part of the user interface, use the Video UI element instead.

Supported video file formats

Unity Studio lets you import the following video file formats:
  • .mp4
  • .m4v
  • .mov
  • .mpg
  • .mpeg
  • .webm
  • .ogv

Add a Video Player component to your scene

To add videos to your scene:
  1. Create an object you want to display the video on.
  2. Select the object in the Hierarchy panel to open the Inspector panel.
  3. Select Add Component > VideoPlayer.
  4. Set Source to Video Asset or URL, then assign a video file or URL to the new property that becomes available.
Your video is attached to your object and is ready to use in the scene.

Video Player component's properties

The following properties are available for you to customize in the Video Player component:

Property

Description

SourceChoose whether to play a video from a file or from a URL. The options are:
  • Video Asset: Select to play a video file from your project.
  • URL: Select to play a video from a website.
Video AssetAttach a video file to play. This setting only appears if you set Source to Video Asset.
URLEnter a direct URL to a video file hosted online. The URL must point directly to the video and typically ends with the file extension, such as .mp4. This is useful if you don’t want to store large video files locally. This option is only available when Source is set to URL.
Play On AwakeChoose whether to start the video when the scene starts or wait until something else triggers the start (for example, use a Logic script to play the video.)
LoopEnable to make the video play again when it reaches the end. Disable to play the video once.
Playback SpeedChoose the speed of the video. Range from 0 to 10. Set to
1
for the original video's playback speed. Set below
1
to slow the video and above
1
to make the video faster.
VolumeChange how loud the video's sound is. Set to 0 for no sound, and 1 for maximum volume.
Aspect RatioControl how the video fits into the UI Transform rectangle. You have the following options:
  • No Scaling: Keep the video's original aspect ratio.
  • Fit Vertically: Scale the video so its height fits the rectangle. This might result in a pillarbox effect if the width doesn't match.
  • Fit Horizontally: Scale the video's width to fit the rectangle. This might result in a letterbox effect if the height doesn't match.
  • Fit Inside: Scale the entire video to fit within the rectangle without cropping. Might have a letterbox effect.
  • Fit Outside: Scale the video to cover the entire rectangle. Might crop parts of the video that overflow.
  • Stretch: Scale independently in X and Y to fill the rectangle. Doesn't preserve aspect ratio. Might distort the image.
Render ModeChoose how the Video Player displays the video. The options are:
  • Camera Far Plane: Renders the video on the camera’s far plane, behind all objects in the scene. This is useful for background videos.
  • Camera Near Plane: Renders the video on the camera’s near plane, in front of all objects in the scene. This causes the video to cover the entire view.
  • Render Texture: Renders the video to a Render Texture, which you can then display elsewhere, such as on a UI element or material. This option is default if you create a UI Video element.
  • Material Override: Renders the video onto a material, which allows you to display it on the surface of an object. The video is projected onto each face of the object. This is the default setting when you add a VideoPlayer component to your non-UI object.

Additional resources