Unity 6.3
0 онлайн 44 гостей 3 в системе
Вход

VideoTimeReference

перечисление

Описание

Часы, которые VideoPlayer используют для обнаружения и корректировки дрейфа.

Используйте эти параметры для управления синхронизацией времени воспроизведения видео с источниками времени.

// 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; }

}

Свойства

Свойство Описание
FreerunВидео воспроизводится без влияния внешних источников времени.
InternalTimeВнутренние опорные часы, по которым VideoPlayer обнаруживает и компенсирует дрейф.
ExternalTimeВнешние референцные часы, которые VideoPlayer использует для обнаружения и корректировки дрейфа.