Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
VideoStreamPlayback
繼承: Resource < RefCounted < Object
VideoStream 使用的內部類,用於管理其在 VideoStreamPlayer 中的播放狀態。
說明
該類旨在被具有 VideoStream 自訂實作的影片解碼器擴充所覆蓋。
方法
_get_channels() virtual const |
|
_get_length() virtual const |
|
_get_mix_rate() virtual const |
|
_get_playback_position() virtual const |
|
_get_texture() virtual const |
|
_is_paused() virtual const |
|
_is_playing() virtual const |
|
void |
_play() virtual |
void |
|
void |
_set_audio_track(idx: int) virtual |
void |
_set_paused(paused: bool) virtual |
void |
_stop() virtual |
void |
|
mix_audio(num_frames: int, buffer: PackedFloat32Array = PackedFloat32Array(), offset: int = 0) |
方法說明
int _get_channels() virtual const 🔗
返回音訊通道的數量。
float _get_length() virtual const 🔗
影片時長已知時返回影片時長,未知時返回 0。
int _get_mix_rate() virtual const 🔗
返回用於混音的音訊取樣速率。
float _get_playback_position() virtual const 🔗
返回目前播放時間戳記。獲取 VideoStreamPlayer.stream_position 時會被調用。
Texture2D _get_texture() virtual const 🔗
分配一個 Texture2D,解碼得到的影片影格會在其中繪製。
bool _is_paused() virtual const 🔗
返回暫停狀態,由 _set_paused() 設定。
bool _is_playing() virtual const 🔗
返回由呼叫 _play() 和 _stop() 決定的播放狀態。
void _play() virtual 🔗
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) virtual 🔗
檢索至第 time 秒。設定 VideoStreamPlayer.stream_position 時會被呼叫。
void _set_audio_track(idx: int) virtual 🔗
選擇 idx 音軌。播放開始時,或者設定 VideoStreamPlayer.audio_track 時會被呼叫。
void _set_paused(paused: bool) virtual 🔗
設定影片播放的暫停狀態。_is_paused() 必須返回 paused。設定 VideoStreamPlayer.paused 時會被呼叫。
void _stop() virtual 🔗
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) virtual required 🔗
Ticks video playback for delta seconds. Called every frame as long as both _is_paused() and _is_playing() return true.
int mix_audio(num_frames: int, buffer: PackedFloat32Array = PackedFloat32Array(), offset: int = 0) 🔗
從陣列中的索引 offset 開始,從 buffer 算繪 num_frames 個音訊影格(每影格 _get_channels() 個浮點數)。返回算繪的音訊影格數,如果出錯則返回 -1。