mirror of https://github.com/godotengine/godot
Merge pull request #77858 from kinami-imai/expose_videostreamplayer_video_length
Expose VideoStreamPlayer video length
This commit is contained in:
commit
1978b7c717
|
|
@ -12,6 +12,13 @@
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
<methods>
|
<methods>
|
||||||
|
<method name="get_stream_length" qualifiers="const">
|
||||||
|
<return type="float" />
|
||||||
|
<description>
|
||||||
|
The length of the current stream, in seconds.
|
||||||
|
[b]Note:[/b] 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.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="get_stream_name" qualifiers="const">
|
<method name="get_stream_name" qualifiers="const">
|
||||||
<return type="String" />
|
<return type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
|
|
||||||
|
|
@ -401,6 +401,13 @@ String VideoStreamPlayer::get_stream_name() const {
|
||||||
return stream->get_name();
|
return stream->get_name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double VideoStreamPlayer::get_stream_length() const {
|
||||||
|
if (playback.is_null()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return playback->get_length();
|
||||||
|
}
|
||||||
|
|
||||||
double VideoStreamPlayer::get_stream_position() const {
|
double VideoStreamPlayer::get_stream_position() const {
|
||||||
if (playback.is_null()) {
|
if (playback.is_null()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -486,6 +493,7 @@ void VideoStreamPlayer::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("get_audio_track"), &VideoStreamPlayer::get_audio_track);
|
ClassDB::bind_method(D_METHOD("get_audio_track"), &VideoStreamPlayer::get_audio_track);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_stream_name"), &VideoStreamPlayer::get_stream_name);
|
ClassDB::bind_method(D_METHOD("get_stream_name"), &VideoStreamPlayer::get_stream_name);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_stream_length"), &VideoStreamPlayer::get_stream_length);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_stream_position", "position"), &VideoStreamPlayer::set_stream_position);
|
ClassDB::bind_method(D_METHOD("set_stream_position", "position"), &VideoStreamPlayer::set_stream_position);
|
||||||
ClassDB::bind_method(D_METHOD("get_stream_position"), &VideoStreamPlayer::get_stream_position);
|
ClassDB::bind_method(D_METHOD("get_stream_position"), &VideoStreamPlayer::get_stream_position);
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ public:
|
||||||
float get_volume_db() const;
|
float get_volume_db() const;
|
||||||
|
|
||||||
String get_stream_name() const;
|
String get_stream_name() const;
|
||||||
|
double get_stream_length() const;
|
||||||
double get_stream_position() const;
|
double get_stream_position() const;
|
||||||
void set_stream_position(double p_position);
|
void set_stream_position(double p_position);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue