Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Play()

Starts or resumes the playback of a video.
Read time 1 minuteLast updated 10 days ago

Definition

public void Play()

Remarks

If the video isn't prepared, this method will prepare the video before it starts playback, but playback won't be instant. To make playback instant, use VideoPlayer.Prepare and wait for preparation to finish (when VideoPlayer.prepareCompleted fires), before you use this method.
If you use VideoPlayer.Prepare and then play the video before preparation finishes, the VideoPlayer will finish preparation and then play the video.

Examples

using UnityEngine;using UnityEngine.Video;public class PlayExample : MonoBehaviour{ void Start() { // Get the VideoPlayer attached to this GameObject. // You need to attach a VideoPlayer component in the Inspector for this script to work. var videoPlayer = GetComponent<VideoPlayer>(); videoPlayer.Play(); }}