time
The presentation time of the currently available frame in VideoPlayer.texture in seconds.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Property
- Namespace: UnityEngine.Video
- Assembly: UnityEngine.VideoModule
public double time { get; set; }
Remarks
Use to achieve the following actions:
VideoPlayer.time- Start the video at a certain time.
- Search through a video.
- Synchronize a part of your clip with another element- for example, with sounds, visual effects or events.
When you set , it initiates a seek operation. For example, if you set , the VideoPlayer:
VideoPlayer.timeVideoPlayer.time = 10 - Starts to move the video towards the 10 second mark.
- Fires the VideoPlayer.seekCompleted event when it reaches 10 seconds.
- Prepares the frame at this time for display.
- Triggers VideoPlayer.frameReady when the frame is prepared and displays the frame.
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.
Examples
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(); }}