VideoStreamPlayback
Internal class used by VideoStream
to manage playback state when played from a VideoStreamPlayer
.
class VideoStreamPlayback
This class is intended to be overridden by video decoder extensions with custom implementations of VideoStream
.
Superclasses
class Resource
Base class for serializable objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
func mixAudio(numFrames: Int32, buffer: PackedFloat32Array, offset: Int32
) -> Int32 Render
numFrames
audio frames (of_getChannels
floats each) frombuffer
, starting from indexoffset
in the array. Returns the number of audio frames rendered, or -1 on error.
Show implementation details (13)
Hide implementation details
func _getChannels(
) -> Int32 Returns the number of audio channels.
func _getLength(
) -> Double Returns the video duration in seconds, if known, or 0 if unknown.
func _getMixRate(
) -> Int32 Returns the audio sample rate used for mixing.
func _getPlaybackPosition(
) -> Double Return the current playback timestamp. Called in response to the
streamPosition
getter.func _getTexture(
) -> Texture2D? Allocates a
Texture2D
in which decoded video frames will be drawn.func _isPaused(
) -> Bool Returns the paused status, as set by
_setPaused(_:)
.func _isPlaying(
) -> Bool Returns the playback state, as determined by calls to
_play
and_stop
.func _play(
) Called in response to
autoplay
orplay
. Note that manual playback may also invoke_stop
multiple times before this method is called._isPlaying
should return true once playing.func _seek(time: Double
) Seeks to
time
seconds. Called in response to thestreamPosition
setter.func _setAudioTrack(idx: Int32
) Select the audio track
idx
. Called when playback starts, and in response to theaudioTrack
setter.func _setPaused(Bool
) Set the paused status of video playback.
_isPaused
must returnpaused
. Called in response to thepaused
setter.func _stop(
) Stops playback. May be called multiple times before
_play
, or in response tostop
._isPlaying
should return false once stopped.func _update(delta: Double
) Ticks video playback for
delta
seconds. Called every frame as long as_isPaused
and_isPlaying
return true.