The presentation time of the currently available frame in VideoPlayer.texture in seconds.
Use VideoPlayer.time
to achieve the following actions:
When you set VideoPlayer.time
, it initiates a seek operation. For example, if you set VideoPlayer.time = 10
, the VideoPlayer:
The time
value only properly settles when the VideoPlayer displays the frame.
If you set time
to another value during this operation, the VideoPlayer creates a new seek operation and adds it to a queue. The new operation will start when the previous one completes.
Additional resources: VideoPlayer.Play, VideoPlayer.texture.
using UnityEngine; using UnityEngine.Video;
public class TimeExample : MonoBehaviour { VideoPlayer videoPlayer;
private void Start() { // Get the VideoPlayer component from the GameObject that contains this script. videoPlayer = GetComponent<VideoPlayer>(); // Skip to 10 seconds into the video. videoPlayer.time = 10.0f; // Play the video. videoPlayer.Play(); } }