VideoStreamPlayback
继承: Resource
< RefCounted
< Object
Internal class used by VideoStream
to manage playback state when played from a VideoStreamPlayer
.
描述
This class is intended to be overridden by video decoder extensions with custom implementations of VideoStream
.
方法
int | _get_channels ( ) virtual1 const2 |
float | _get_length ( ) virtual1 const2 |
int | _get_mix_rate ( ) virtual1 const2 |
float | _get_playback_position ( ) virtual1 const2 |
Texture2D | _get_texture ( ) virtual1 const2 |
bool | _is_paused ( ) virtual1 const2 |
bool | _is_playing ( ) virtual1 const2 |
void | _play ( ) virtual1 |
void | _seek ( time: float ) virtual1 |
void | _set_audio_track ( idx: int ) virtual1 |
void | _set_paused ( paused: bool ) virtual1 |
void | _stop ( ) virtual1 |
void | _update ( delta: float ) virtual1 |
int | mix_audio ( num_frames: int , buffer: PackedFloat32Array = PackedFloat32Array(), offset: int = 0 ) |
方法说明
int
_get_channels ( ) virtual1 const2
Returns the number of audio channels.
float
_get_length ( ) virtual1 const2
Returns the video duration in seconds, if known, or 0 if unknown.
int
_get_mix_rate ( ) virtual1 const2
Returns the audio sample rate used for mixing.
float
_get_playback_position ( ) virtual1 const2
Return the current playback timestamp. Called in response to the VideoStreamPlayer.stream_position
getter.
Texture2D
_get_texture ( ) virtual1 const2
Allocates a Texture2D
in which decoded video frames will be drawn.
bool
_is_paused ( ) virtual1 const2
Returns the paused status, as set by _set_paused
.
bool
_is_playing ( ) virtual1 const2
Returns the playback state, as determined by calls to _play
and _stop
.
void
_play ( ) virtual1
Called in response to VideoStreamPlayer.autoplay
or VideoStreamPlayer.play
. Note that manual playback may also invoke _stop
multiple times before this method is called. _is_playing
should return true once playing.
void
_seek ( time: float
) virtual1
Seeks to time
seconds. Called in response to the VideoStreamPlayer.stream_position
setter.
void
_set_audio_track ( idx: int
) virtual1
Select the audio track idx
. Called when playback starts, and in response to the VideoStreamPlayer.audio_track
setter.
void
_set_paused ( paused: bool
) virtual1
Set the paused status of video playback. _is_paused
must return paused
. Called in response to the VideoStreamPlayer.paused
setter.
void
_stop ( ) virtual1
Stops playback. May be called multiple times before _play
, or in response to VideoStreamPlayer.stop
. _is_playing
should return false once stopped.
void
_update ( delta: float
) virtual1
Ticks video playback for delta
seconds. Called every frame as long as _is_paused
and _is_playing
return true.
int
mix_audio ( num_frames: int
, buffer: PackedFloat32Array
= PackedFloat32Array(), offset: int
= 0 )
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.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。