VideoStreamPlayer
UI control for video and its audio playback.
Assign a VideoStream resource, add VideoStreamPlayer to the tree and call Play, or configure Autoplay beforehand. File format and seeking accuracy depend on the stream implementation. Built-in VideoStreamTheora loads Ogg Theora .ogv; renaming another file does not add codec support.
Use Paused to pause and Stop to stop. Expand stretches frames to Control size without a separate aspect-preservation mode: provide an appropriate aspect ratio through layout. Finished means natural completion without Loop rather than manual Stop.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
VideoStreamPlayerConstructor
public VideoStreamPlayer();Creates a UI video player. Play requires tree membership and a valid Stream providing a decoder.
Properties12
AudioTrackProperty
public int AudioTrack { get; set; }Audio-track index, normally zero-based. Passed to the shared Stream and current playback; switching support depends on the decoder. Does not create a track or choose an audio bus.
AutoplayProperty
public bool Autoplay { get; set; }Starts on tree entry when Stream is already assigned and this is not the editor. Enabling it after entry does not itself call Play; assigning Stream later is not another tree entry.
BufferingMsecProperty
public int BufferingMsec { get; set; }Audio-buffering duration in milliseconds for playback setup. The setter stores the value without rebuilding an existing buffer: configure before Stream or reassign the stream. Neither movie duration nor a network video buffer.
BusProperty
public StringName Bus { get; set; }Existing audio-bus name. The getter falls back to Master when the named bus is missing. Assignment neither creates a bus nor chooses a video track.
ExpandProperty
public bool Expand { get; set; }true stretches frames to current Size and removes the video-resolution minimum size. false draws at natural frame size. Stretching does not automatically preserve aspect ratio.
LoopProperty
public bool Loop { get; set; }Calls Play again on natural completion instead of Finished. The playback implementation supplies restart behavior. Does not turn manual Stop into a completion event.
PausedProperty
public bool Paused { get; set; }User pause state; false resumes processing when the tree allows it. Not equivalent to IsPlaying. Tree pause/suspension may temporarily pause decoding without changing this user flag.
SpeedScaleProperty
public float SpeedScale { get; set; }Nonnegative video/audio progression multiplier; one is normal speed, negative values are rejected. Zero does not set Paused; use Paused for explicit pause state. Applies together with engine time scaling.
StreamProperty
public VideoStream Stream { get; set; }Video resource. Assignment stops the old stream, creates a new playback and updates the texture/audio buffer. null removes it. Players may share a resource while using separate playback objects; the resource itself remains shared.
StreamPositionProperty
public double StreamPosition { get; set; }Position in seconds. The setter flushes queued audio and delegates seeking to the decoder; does not validate bounds or guarantee an exact frame. With known duration use zero <= position < length; Theora ignores positions at or beyond duration. The getter returns zero without playback.
VolumeProperty
public float Volume { get; set; }Linear audio multiplier: zero is silence, one is the original level, values above one amplify. Use nonnegative values. Does not affect frame brightness or replace bus volume.
VolumeDbProperty
public float VolumeDb { get; set; }The same volume in decibels: zero dB corresponds to Volume one. Below -79 dB sets silence; the getter returns -80 for silence. Not an independent second volume control.
Methods30
GetAudioTrackint
public int GetAudioTrack();Audio-track index, normally zero-based. Passed to the shared Stream and current playback; switching support depends on the decoder. Does not create a track or choose an audio bus.
intAudio-track index, normally zero-based. Passed to the shared Stream and current playback; switching support depends on the decoder. Does not create a track or choose an audio bus.
GetBufferingMsecint
public int GetBufferingMsec();Audio-buffering duration in milliseconds for playback setup. The setter stores the value without rebuilding an existing buffer: configure before Stream or reassign the stream. Neither movie duration nor a network video buffer.
intAudio-buffering duration in milliseconds for playback setup. The setter stores the value without rebuilding an existing buffer: configure before Stream or reassign the stream. Neither movie duration nor a network video buffer.
GetBusStringName
public StringName GetBus();Existing audio-bus name. The getter falls back to Master when the named bus is missing. Assignment neither creates a bus nor chooses a video track.
StringNameExisting audio-bus name. The getter falls back to Master when the named bus is missing. Assignment neither creates a bus nor chooses a video track.
GetSpeedScalefloat
public float GetSpeedScale();Nonnegative video/audio progression multiplier; one is normal speed, negative values are rejected. Zero does not set Paused; use Paused for explicit pause state. Applies together with engine time scaling.
floatNonnegative video/audio progression multiplier; one is normal speed, negative values are rejected. Zero does not set Paused; use Paused for explicit pause state. Applies together with engine time scaling.
GetStreamVideoStream
public VideoStream GetStream();Video resource. Assignment stops the old stream, creates a new playback and updates the texture/audio buffer. null removes it. Players may share a resource while using separate playback objects; the resource itself remains shared.
VideoStreamVideo resource. Assignment stops the old stream, creates a new playback and updates the texture/audio buffer. null removes it. Players may share a resource while using separate playback objects; the resource itself remains shared.
GetStreamLengthdouble
public double GetStreamLength();Duration in seconds from the decoder, zero without playback or when the implementation has no duration information. Zero does not prove an empty file.
doubleDuration in seconds from the decoder, zero without playback or when the implementation has no duration information. Zero does not prove an empty file.
GetStreamNamestring
public string GetStreamName();Stream resource name, not necessarily its filename. Returns the service string <No Stream> without a resource. Use the resource File property for its path.
stringStream resource name, not necessarily its filename. Returns the service string <No Stream> without a resource. Use the resource File property for its path.
GetStreamPositiondouble
public double GetStreamPosition();Position in seconds. The setter flushes queued audio and delegates seeking to the decoder; does not validate bounds or guarantee an exact frame. With known duration use zero <= position < length; Theora ignores positions at or beyond duration. The getter returns zero without playback.
doublePosition in seconds. The setter flushes queued audio and delegates seeking to the decoder; does not validate bounds or guarantee an exact frame. With known duration use zero <= position < length; Theora ignores positions at or beyond duration. The getter returns zero without playback.
GetVideoTextureTexture2D
public Texture2D GetVideoTexture();Returns the decoder’s shared current texture, or null without playback. May change as decoding proceeds rather than being a frame snapshot. Do not free it as an owned server resource.
Texture2DReturns the decoder’s shared current texture, or null without playback. May change as decoding proceeds rather than being a frame snapshot. Do not free it as an owned server resource.
GetVolumefloat
public float GetVolume();Linear audio multiplier: zero is silence, one is the original level, values above one amplify. Use nonnegative values. Does not affect frame brightness or replace bus volume.
floatLinear audio multiplier: zero is silence, one is the original level, values above one amplify. Use nonnegative values. Does not affect frame brightness or replace bus volume.
GetVolumeDbfloat
public float GetVolumeDb();The same volume in decibels: zero dB corresponds to Volume one. Below -79 dB sets silence; the getter returns -80 for silence. Not an independent second volume control.
floatThe same volume in decibels: zero dB corresponds to Volume one. Below -79 dB sets silence; the getter returns -80 for silence. Not an independent second volume control.
HasAutoplaybool
public bool HasAutoplay();Starts on tree entry when Stream is already assigned and this is not the editor. Enabling it after entry does not itself call Play; assigning Stream later is not another tree entry.
boolStarts on tree entry when Stream is already assigned and this is not the editor. Enabling it after entry does not itself call Play; assigning Stream later is not another tree entry.
HasExpandbool
public bool HasExpand();true stretches frames to current Size and removes the video-resolution minimum size. false draws at natural frame size. Stretching does not automatically preserve aspect ratio.
booltrue stretches frames to current Size and removes the video-resolution minimum size. false draws at natural frame size. Stretching does not automatically preserve aspect ratio.
HasLoopbool
public bool HasLoop();Calls Play again on natural completion instead of Finished. The playback implementation supplies restart behavior. Does not turn manual Stop into a completion event.
boolCalls Play again on natural completion instead of Finished. The playback implementation supplies restart behavior. Does not turn manual Stop into a completion event.
IsPausedbool
public bool IsPaused();User pause state; false resumes processing when the tree allows it. Not equivalent to IsPlaying. Tree pause/suspension may temporarily pause decoding without changing this user flag.
boolUser pause state; false resumes processing when the tree allows it. Not equivalent to IsPlaying. Tree pause/suspension may temporarily pause decoding without changing this user flag.
IsPlayingbool
public bool IsPlaying();Returns playback state or false without one. Does not test audible sound or a newly drawn frame; a paused decoder may still report playing.
boolReturns playback state or false without one. Does not test audible sound or a newly drawn frame; a paused decoder may still report playing.
Playvoid
public void Play();Starts the current decoder; requires the control in the tree and a prepared Stream. Repeated Play does not guarantee restarting from the beginning for every implementation. Resume a pause with Paused false.
SetAudioTrackvoid
public void SetAudioTrack(int track);Audio-track index, normally zero-based. Passed to the shared Stream and current playback; switching support depends on the decoder. Does not create a track or choose an audio bus.
| Name | Type | Default |
|---|---|---|
track | int | — |
trackFormat-specific audio-track index, normally zero-based.
SetAutoplayvoid
public void SetAutoplay(bool enabled);Starts on tree entry when Stream is already assigned and this is not the editor. Enabling it after entry does not itself call Play; assigning Stream later is not another tree entry.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledStart on tree entry when Stream is already assigned.
SetBufferingMsecvoid
public void SetBufferingMsec(int msec);Audio-buffering duration in milliseconds for playback setup. The setter stores the value without rebuilding an existing buffer: configure before Stream or reassign the stream. Neither movie duration nor a network video buffer.
| Name | Type | Default |
|---|---|---|
msec | int | — |
msecNonnegative audio-buffer duration in milliseconds.
SetBusvoid
public void SetBus(StringName bus);Existing audio-bus name. The getter falls back to Master when the named bus is missing. Assignment neither creates a bus nor chooses a video track.
| Name | Type | Default |
|---|---|---|
bus | StringName | — |
busExisting audio-bus name.
SetExpandvoid
public void SetExpand(bool enable);true stretches frames to current Size and removes the video-resolution minimum size. false draws at natural frame size. Stretching does not automatically preserve aspect ratio.
| Name | Type | Default |
|---|---|---|
enable | bool | — |
enableStretch frames to Control size.
SetLoopvoid
public void SetLoop(bool loop);Calls Play again on natural completion instead of Finished. The playback implementation supplies restart behavior. Does not turn manual Stop into a completion event.
| Name | Type | Default |
|---|---|---|
loop | bool | — |
loopRepeat naturally completed playback.
SetPausedvoid
public void SetPaused(bool paused);User pause state; false resumes processing when the tree allows it. Not equivalent to IsPlaying. Tree pause/suspension may temporarily pause decoding without changing this user flag.
| Name | Type | Default |
|---|---|---|
paused | bool | — |
pausedPause advancement without ending the stream.
SetSpeedScalevoid
public void SetSpeedScale(float speedScale);Nonnegative video/audio progression multiplier; one is normal speed, negative values are rejected. Zero does not set Paused; use Paused for explicit pause state. Applies together with engine time scaling.
| Name | Type | Default |
|---|---|---|
speedScale | float | — |
speedScaleNonnegative speed multiplier; one is normal speed.
SetStreamvoid
public void SetStream(VideoStream stream);Video resource. Assignment stops the old stream, creates a new playback and updates the texture/audio buffer. null removes it. Players may share a resource while using separate playback objects; the resource itself remains shared.
| Name | Type | Default |
|---|---|---|
stream | VideoStream | — |
streamVideoStream resource providing a decoder, or null to remove it.
SetStreamPositionvoid
public void SetStreamPosition(double position);Position in seconds. The setter flushes queued audio and delegates seeking to the decoder; does not validate bounds or guarantee an exact frame. With known duration use zero <= position < length; Theora ignores positions at or beyond duration. The getter returns zero without playback.
| Name | Type | Default |
|---|---|---|
position | double | — |
positionDesired position in seconds; the decoder determines validity.
SetVolumevoid
public void SetVolume(float volume);Linear audio multiplier: zero is silence, one is the original level, values above one amplify. Use nonnegative values. Does not affect frame brightness or replace bus volume.
| Name | Type | Default |
|---|---|---|
volume | float | — |
volumeNonnegative linear audio multiplier.
SetVolumeDbvoid
public void SetVolumeDb(float db);The same volume in decibels: zero dB corresponds to Volume one. Below -79 dB sets silence; the getter returns -80 for silence. Not an independent second volume control.
| Name | Type | Default |
|---|---|---|
db | float | — |
dbLevel in dB; below -79 sets silence.
Stopvoid
public void Stop();Stops playback and flushes queued audio. Does not emit Finished; position reset depends on the decoder, with Theora seeking to the start. Does nothing outside the tree.
Signals and events1
FinishedEvent
public event Action Finished;Natural completion of the current playback with Loop disabled. Not emitted by manual Stop; does not mean the player/resource was deleted.