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

VideoPlayer.isPrepared

Declaration

public bool isPrepared;

Описание

Возвращает, успешно ли VideoPlayer подготовил контент для воспроизведения.

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

A VideoPlayer начинает работу как неподготовленный (false). Для подготовки VideoPlayer, вам нужно использовать VideoPlayer.Prepare. Когда подготовка завершена, VideoPlayer выделяет VideoPlayer.prepareCompleted событие, которое определяет isPrepared до true.

Имущество возвращается к false когда вы или VideoPlayer звонки VideoPlayer.Stop.

При сбоях подготовки это свойство может никогда не быть установлено в true. В этом случае Unity отправляет описание ошибки через VideoPlayer.errorReceived событие.

Дополнительные ресурсы: VideoPlayer.Prepare.

using UnityEngine;
using UnityEngine.Video;
using System.Collections;

// In the Inspector of your GameObject, attach this script and a VideoPlayer component. // Also, assign a VideoClip to your VideoPlayer component. // Use this script to prepare a video.

public class IsPreparedExample : MonoBehaviour { public IEnumerator Start() { VideoPlayer videoPlayer = GetComponent<VideoPlayer>(); videoPlayer.Prepare(); // Loops until the video is ready. // Then outputs the message to the console when the preparation is done. while (!videoPlayer.isPrepared) { yield return null; } Debug.Log("Preparation completed!"); } }