# VideoTimeReference

> The clock that the VideoPlayer observes to detect and correct drift.

## Definition

* **Type:** Enum
* **Namespace:** [UnityEngine.Video](/engine/6000.5/script-reference/unityengine/video.md)
* **Assembly:** UnityEngine.VideoModule

```csharp
public enum VideoTimeReference
```

## Remarks

Use these settings to control how the playback time of the video is synchronized with time sources.

## Examples

```csharp
// This script changes the video playback speed based on a custom timer. 
// Attach this script and a VideoPlayer component to a GameObject in your Scene. 
// Assign a video clip to the VideoPlayer. 

using UnityEngine;
using UnityEngine.Video;

public class VideoTimeReferenceExample : MonoBehaviour
{
    VideoPlayer videoPlayer; 
    float customExternalTime = 0.0f;
    float timeSlider = 1.0f;

    private void OnGUI()
    {
        // Create a slider you can use to change the playback speed. 
        GUI.Label(new Rect(0, 0, 300, 300),$"Time scale : {timeSlider}");
        timeSlider = GUI.HorizontalSlider(new Rect(0, 30, 300, 300), timeSlider, 1.0f, 3.0f);
    }

    void Start()
    {
        videoPlayer = GetComponent<VideoPlayer>();
        if (!videoPlayer)
        {
            Debug.LogError("VideoPlayer not assigned!");
            return;
        }

        // Set default time reference to External time. 
        videoPlayer.timeReference = VideoTimeReference.ExternalTime;
        videoPlayer.Play();
    }

    void Update()
    {
        // Increment custom time manually. 
        customExternalTime += timeSlider * Time.deltaTime;
        videoPlayer.externalReferenceTime = customExternalTime;
    }

}
```

## Fields

| Value                                                                                                | Description                                                                                                                                            |
| ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [ExternalTime](/engine/6000.5/script-reference/unityengine/video/videotimereference/externaltime.md) | The external reference clock the [VideoPlayer](/engine/6000.5/script-reference/unityengine/video/videoplayer.md) observes to detect and correct drift. |
| [Freerun](/engine/6000.5/script-reference/unityengine/video/videotimereference/freerun.md)           | The video plays without influence from external time sources.                                                                                          |
| [InternalTime](/engine/6000.5/script-reference/unityengine/video/videotimereference/internaltime.md) | The internal reference clock the [VideoPlayer](/engine/6000.5/script-reference/unityengine/video/videoplayer.md) observes to detect and correct drift. |
