:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/4.1/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/4.1/doc/classes/VideoStreamPlayback.xml. .. _class_VideoStreamPlayback: VideoStreamPlayback =================== **Inherits:** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` Internal class used by :ref:`VideoStream` to manage playback state when played from a :ref:`VideoStreamPlayer`. .. rst-class:: classref-introduction-group Description ----------- This class is intended to be overridden by video decoder extensions with custom implementations of :ref:`VideoStream`. .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`_get_channels` **(** **)** |virtual| |const| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`_get_length` **(** **)** |virtual| |const| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`_get_mix_rate` **(** **)** |virtual| |const| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`_get_playback_position` **(** **)** |virtual| |const| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Texture2D` | :ref:`_get_texture` **(** **)** |virtual| |const| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`_is_paused` **(** **)** |virtual| |const| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`_is_playing` **(** **)** |virtual| |const| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_play` **(** **)** |virtual| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_seek` **(** :ref:`float` time **)** |virtual| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_set_audio_track` **(** :ref:`int` idx **)** |virtual| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_set_paused` **(** :ref:`bool` paused **)** |virtual| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_stop` **(** **)** |virtual| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_update` **(** :ref:`float` delta **)** |virtual| | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`mix_audio` **(** :ref:`int` num_frames, :ref:`PackedFloat32Array` buffer=PackedFloat32Array(), :ref:`int` offset=0 **)** | +-----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_VideoStreamPlayback_method__get_channels: .. rst-class:: classref-method :ref:`int` **_get_channels** **(** **)** |virtual| |const| Returns the number of audio channels. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__get_length: .. rst-class:: classref-method :ref:`float` **_get_length** **(** **)** |virtual| |const| Returns the video duration in seconds, if known, or 0 if unknown. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__get_mix_rate: .. rst-class:: classref-method :ref:`int` **_get_mix_rate** **(** **)** |virtual| |const| Returns the audio sample rate used for mixing. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__get_playback_position: .. rst-class:: classref-method :ref:`float` **_get_playback_position** **(** **)** |virtual| |const| Return the current playback timestamp. Called in response to the :ref:`VideoStreamPlayer.stream_position` getter. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__get_texture: .. rst-class:: classref-method :ref:`Texture2D` **_get_texture** **(** **)** |virtual| |const| Allocates a :ref:`Texture2D` in which decoded video frames will be drawn. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__is_paused: .. rst-class:: classref-method :ref:`bool` **_is_paused** **(** **)** |virtual| |const| Returns the paused status, as set by :ref:`_set_paused`. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__is_playing: .. rst-class:: classref-method :ref:`bool` **_is_playing** **(** **)** |virtual| |const| Returns the playback state, as determined by calls to :ref:`_play` and :ref:`_stop`. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__play: .. rst-class:: classref-method void **_play** **(** **)** |virtual| Called in response to :ref:`VideoStreamPlayer.autoplay` or :ref:`VideoStreamPlayer.play`. Note that manual playback may also invoke :ref:`_stop` multiple times before this method is called. :ref:`_is_playing` should return true once playing. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__seek: .. rst-class:: classref-method void **_seek** **(** :ref:`float` time **)** |virtual| Seeks to ``time`` seconds. Called in response to the :ref:`VideoStreamPlayer.stream_position` setter. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__set_audio_track: .. rst-class:: classref-method void **_set_audio_track** **(** :ref:`int` idx **)** |virtual| Select the audio track ``idx``. Called when playback starts, and in response to the :ref:`VideoStreamPlayer.audio_track` setter. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__set_paused: .. rst-class:: classref-method void **_set_paused** **(** :ref:`bool` paused **)** |virtual| Set the paused status of video playback. :ref:`_is_paused` must return ``paused``. Called in response to the :ref:`VideoStreamPlayer.paused` setter. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__stop: .. rst-class:: classref-method void **_stop** **(** **)** |virtual| Stops playback. May be called multiple times before :ref:`_play`, or in response to :ref:`VideoStreamPlayer.stop`. :ref:`_is_playing` should return false once stopped. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method__update: .. rst-class:: classref-method void **_update** **(** :ref:`float` delta **)** |virtual| Ticks video playback for ``delta`` seconds. Called every frame as long as :ref:`_is_paused` and :ref:`_is_playing` return true. .. rst-class:: classref-item-separator ---- .. _class_VideoStreamPlayback_method_mix_audio: .. rst-class:: classref-method :ref:`int` **mix_audio** **(** :ref:`int` num_frames, :ref:`PackedFloat32Array` buffer=PackedFloat32Array(), :ref:`int` offset=0 **)** Render ``num_frames`` audio frames (of :ref:`_get_channels` floats each) from ``buffer``, starting from index ``offset`` in the array. Returns the number of audio frames rendered, or -1 on error. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`