VideoStreamPlayer
A control used for video playback.
VideoStreamPlayer.swift:27class VideoStreamPlayer
A control used for playback of VideoStream
resources.
Supported video formats are Ogg Theora (.ogv
, VideoStreamTheora
) and any format exposed via a GDExtension plugin.
This object emits the following signals:
Superclasses
class Control
Base class for all GUI controls. Adapts its position and size based on its parent control.
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
var audioTrack: Int32
The embedded audio track to play.
var autoplay: Bool
If
true
, playback starts when the scene loads.var bufferingMsec: Int32
Amount of time in milliseconds to store in buffer while playing.
var bus: StringName
Audio bus to use for sound playback.
var expand: Bool
If
true
, the video scales to the control size. Otherwise, the control minimum size will be automatically adjusted to match the video stream’s dimensions.var finished: SimpleSignal
Emitted when playback is finished.
var loop: Bool
If
true
, the video restarts when it reaches its end.var paused: Bool
If
true
, the video is paused.var stream: VideoStream?
The assigned video stream. See description for supported formats.
var streamPosition: Double
The current position of the stream, in seconds.
var volume: Double
Audio volume as a linear value.
var volumeDb: Double
Audio volume in dB.
func getStreamLength(
) -> Double The length of the current stream, in seconds.
func getStreamName(
) -> String Returns the video stream’s name, or
"<No Stream>"
if no video stream is assigned.func getVideoTexture(
) -> Texture2D? Returns the current frame as a
Texture2D
.func isPlaying(
) -> Bool Returns
true
if the video is playing.func play(
) Starts the video playback from the beginning. If the video is paused, this will not unpause the video.
func stop(
) Stops the video playback and sets the stream position to 0.