Class VisionOSVideoComponent
A custom component to provide video capabilities to a target platform.
Inherited Members
Namespace: Unity.PolySpatial
Assembly: Unity.PolySpatial.dll
Syntax
[DisallowMultipleComponent]
public class VisionOSVideoComponent : MonoBehaviour
Fields
VideoClipStateChanged
An event that is triggered when the state of a video asset changes. This can be used to react to state changes such as when a video clip has been prerolled by visionOS or if visionOS could not find the video asset at all.
Declaration
[Tooltip("An event that is triggered when the state of a video asset changes.")]
public UnityEvent<VisionOSVideoComponent.VideoAssetState> VideoClipStateChanged
Field Value
Type | Description |
---|---|
UnityEvent<VisionOSVideoComponent.VideoAssetState> |
Properties
Clip
The video asset to play.
Declaration
public VideoClip Clip { get; set; }
Property Value
Type | Description |
---|---|
VideoClip |
IsLooping
Whether the video should repeat when playback reaches the end of the clip.
Declaration
public bool IsLooping { get; set; }
Property Value
Type | Description |
---|---|
bool |
PlayOnAwake
Whether video clip should play on awake.
Declaration
public bool PlayOnAwake { get; set; }
Property Value
Type | Description |
---|---|
bool |
RequestPreroll
Requests that a clip be prerolled before playing. This may reduce lag when the clip is played. PlayOnAwake should be disabled if this is enabled. Prerolling works only when a player is first created.
Declaration
public bool RequestPreroll { get; set; }
Property Value
Type | Description |
---|---|
bool |
Source
Path to the video asset to play.
Declaration
public VisionOSVideoComponent.SourceType Source { get; set; }
Property Value
Type | Description |
---|---|
VisionOSVideoComponent.SourceType |
TargetMaterialRenderer
The mesh renderer on which the video should render. Overwrites the current material on the renderer.
Declaration
public MeshRenderer TargetMaterialRenderer { get; set; }
Property Value
Type | Description |
---|---|
MeshRenderer |
Url
Path to the video asset to play. This can be an absolute URL, or this can just be the name of the video clip and the extension (e.g. "videoclip.mov") in which case, the asset will be searched for in the mainBundle of the Xcode project.
Declaration
public string Url { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
GetDirectAudioMute(ushort)
Gets the mute status of first track on the video clip.
Declaration
public bool GetDirectAudioMute(ushort trackIndex)
Parameters
Type | Name | Description |
---|---|---|
ushort | trackIndex | The track index (indices greater than 0 not supported). |
Returns
Type | Description |
---|---|
bool | The mute status of first track on the video clip. |
GetDirectAudioVolume(ushort)
Gets the volume of the first track on the video clip.
Declaration
public float GetDirectAudioVolume(ushort trackIndex)
Parameters
Type | Name | Description |
---|---|---|
ushort | trackIndex | The track index (indices greater than 0 not supported). |
Returns
Type | Description |
---|---|
float | The volume between 0.0 and 1.0 |
GetState()
Obtain the current play state of the video player.
Declaration
public VisionOSVideoComponent.PlayerState GetState()
Returns
Type | Description |
---|---|
VisionOSVideoComponent.PlayerState | The player state. |
Pause()
Pauses the playback of the video.
Declaration
public void Pause()
Play()
Starts playback of the video.
Declaration
public void Play()
SetDirectAudioMute(ushort, bool)
Sets the mute state of the first track on the video clip.
Declaration
public void SetDirectAudioMute(ushort trackIndex, bool mute)
Parameters
Type | Name | Description |
---|---|---|
ushort | trackIndex | The track index (indices greater than 0 not supported). |
bool | mute | The mute state to set. |
SetDirectAudioVolume(ushort, float)
Sets the volume of the first track on the video clip.
Declaration
public void SetDirectAudioVolume(ushort trackIndex, float volume)
Parameters
Type | Name | Description |
---|---|---|
ushort | trackIndex | The track index (indices greater than 0 not supported). |
float | volume | The volume to set between 0.0 and 1.0. |
Stop()
Stops the playback of the video.
Declaration
public void Stop()