Table of Contents

Class VideoStreamPlayer

Namespace
Godot
Assembly
GodotSharp.dll

A control used for playback of VideoStream resources.

Supported video formats are Ogg Theora (.ogv, VideoStreamTheora) and any format exposed via a GDExtension plugin.

Warning: On Web, video playback will perform poorly due to missing architecture-specific assembly optimizations.

public class VideoStreamPlayer : Control, IDisposable
Inheritance
VideoStreamPlayer
Implements
Inherited Members

Constructors

VideoStreamPlayer()

public VideoStreamPlayer()

Properties

AudioTrack

The embedded audio track to play.

public int AudioTrack { get; set; }

Property Value

int

Autoplay

If true, playback starts when the scene loads.

public bool Autoplay { get; set; }

Property Value

bool

BufferingMsec

Amount of time in milliseconds to store in buffer while playing.

public int BufferingMsec { get; set; }

Property Value

int

Bus

Audio bus to use for sound playback.

public StringName Bus { get; set; }

Property Value

StringName

Expand

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.

public bool Expand { get; set; }

Property Value

bool

Loop

If true, the video restarts when it reaches its end.

public bool Loop { get; set; }

Property Value

bool

Paused

If true, the video is paused.

public bool Paused { get; set; }

Property Value

bool

Stream

The assigned video stream. See description for supported formats.

public VideoStream Stream { get; set; }

Property Value

VideoStream

StreamPosition

The current position of the stream, in seconds.

Note: Changing this value won't have any effect as seeking is not implemented yet, except in video formats implemented by a GDExtension add-on.

public double StreamPosition { get; set; }

Property Value

double

Volume

Audio volume as a linear value.

public float Volume { get; set; }

Property Value

float

VolumeDb

Audio volume in dB.

public float VolumeDb { get; set; }

Property Value

float

Methods

GetStreamLength()

The length of the current stream, in seconds.

Note: For VideoStreamTheora streams (the built-in format supported by Godot), this value will always be zero, as getting the stream length is not implemented yet. The feature may be supported by video formats implemented by a GDExtension add-on.

public double GetStreamLength()

Returns

double

GetStreamName()

Returns the video stream's name, or "<No Stream>" if no video stream is assigned.

public string GetStreamName()

Returns

string

GetVideoTexture()

Returns the current frame as a Texture2D.

public Texture2D GetVideoTexture()

Returns

Texture2D

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsPlaying()

Returns true if the video is playing.

Note: The video is still considered playing if paused during playback.

public bool IsPlaying()

Returns

bool

Play()

Starts the video playback from the beginning. If the video is paused, this will not unpause the video.

public void Play()

Stop()

Stops the video playback and sets the stream position to 0.

Note: Although the stream position will be set to 0, the first frame of the video stream won't become the current frame.

public void Stop()

Events

Finished

Emitted when playback is finished.

public event Action Finished

Event Type

Action