Class VideoStreamPlayback
Internal class used by VideoStream to manage playback state when played from a VideoStreamPlayer.
- Inheritance
-
VideoStreamPlayback
Remarks
This class is intended to be overridden by video decoder extensions with custom implementations of VideoStream.
Methods
_get_channels
Qualifiers: virtualconst
Returns the number of audio channels.
int _get_channels
_get_length
Qualifiers: virtualconst
Returns the video duration in seconds, if known, or 0 if unknown.
float _get_length
_get_mix_rate
Qualifiers: virtualconst
Returns the audio sample rate used for mixing.
int _get_mix_rate
_get_playback_position
Qualifiers: virtualconst
Return the current playback timestamp. Called in response to the stream_position getter.
float _get_playback_position
_get_texture
Qualifiers: virtualconst
Allocates a Texture2D in which decoded video frames will be drawn.
Texture2D _get_texture
_is_paused
Qualifiers: virtualconst
Returns the paused status, as set by VideoStreamPlayback._set_paused.
bool _is_paused
_is_playing
bool _is_playing
_play
Qualifiers: virtual
Called in response to autoplay or play. Note that manual playback may also invoke _stop multiple times before this method is called. _is_playing should return true
once playing.
void _play
_seek(float)
Qualifiers: virtual
Seeks to time
seconds. Called in response to the stream_position setter.
void _seek(float time)
Parameters
time
float
_set_audio_track(int)
Qualifiers: virtual
Select the audio track idx
. Called when playback starts, and in response to the audio_track setter.
void _set_audio_track(int idx)
Parameters
idx
int
_set_paused(bool)
Qualifiers: virtual
Set the paused status of video playback. _is_paused must return paused
. Called in response to the paused setter.
void _set_paused(bool paused)
Parameters
paused
bool
_stop
Qualifiers: virtual
Stops playback. May be called multiple times before _play, or in response to stop. _is_playing should return false
once stopped.
void _stop
_update(float)
Qualifiers: virtual
Ticks video playback for delta
seconds. Called every frame as long as both _is_paused and _is_playing return true
.
void _update(float delta)
Parameters
delta
float
mix_audio(int, PackedFloat32Array, int)
Render num_frames
audio frames (of _get_channels floats each) from buffer
, starting from index offset
in the array. Returns the number of audio frames rendered, or -1 on error.
int mix_audio(int num_frames, PackedFloat32Array buffer, int offset)
Parameters
num_frames
intbuffer
PackedFloat32Arrayoffset
int