VideoPlayer
La référence est en anglais : elle est générée à partir des commentaires du code, écrits en anglais.
public sealed class VideoPlayer : ObjectNamespace NodeWorld.Flux.
A video player of the client (libVLC): web pages of video sites are resolved to their media by the client (yt-dlp). Its picture goes into a texture property of world materials (SetMaterialTarget), its sound into world audio sources (SetAudioOutputs: their volume, mute and 3D settings apply). Each client plays for itself: the script synchronizes what plays and where. Released with Release or when the world unloads. Client only.
Properties
state
public VideoState state { get; }Where the player is: loading, ready, playing, paused, ended, failed.
error
public VideoError error { get; }Why it failed, while state is Error.
isPlaying
public bool isPlaying { get; }state is Playing.
isLive
public bool isLive { get; }A live stream: no duration, no seeking.
width
public int width { get; }Width of the picture, in pixels.
height
public int height { get; }Height of the picture, in pixels.
time
public float time { get; set; }Position in the media (s); setting it seeks.
duration
public float duration { get; }Length of the media (s); 0 while unknown, and for a live stream.
rate
public float rate { get; set; }Playback speed (1 normal).
Methods
Create
public static VideoPlayer Create()A new video player of this player's game. On a game without a video player, its error is Unavailable.
Load
public void Load(string url, float startTime = 0f, bool play = true)Opens the media at url (http, https, rtmp, rtsp) from startTime seconds; it plays when loaded if play.
Play
public void Play()Plays the media loaded.
Pause
public void Pause()Pauses it.
Stop
public void Stop()Unloads the media (Idle).
SetMaterialTarget
public void SetMaterialTarget(Material material, string textureProperty, bool show = true)The material shows the picture in that texture property (until it is set to null); several materials may.
SetAudioOutputs
public void SetAudioOutputs(AudioSource[] sources, float[] gainsDb = null)These audio sources of the world play the sound (replaces the previous ones; none: silent), each with a gain in dB (gainsDb, same length; null: 0 dB), applied before the source's own volume.
Release
public void Release()Frees the player; it is freed with the world too.
