Add function set_stream_position to VideoPlayer
Also add docucmentation for set_stream_position in VideoPlayer
This commit is contained in:
parent
b12455cde8
commit
43410ca363
3 changed files with 17 additions and 0 deletions
|
@ -156,6 +156,15 @@
|
||||||
Set the video stream for this player.
|
Set the video stream for this player.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="set_stream_position">
|
||||||
|
<return type="void">
|
||||||
|
</return>
|
||||||
|
<argument index="0" name="position" type="float">
|
||||||
|
</argument>
|
||||||
|
<description>
|
||||||
|
Set the current position of the stream, in seconds.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="set_volume">
|
<method name="set_volume">
|
||||||
<return type="void">
|
<return type="void">
|
||||||
</return>
|
</return>
|
||||||
|
|
|
@ -285,6 +285,12 @@ float VideoPlayer::get_stream_position() const {
|
||||||
return playback->get_playback_position();
|
return playback->get_playback_position();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void VideoPlayer::set_stream_position(float p_position) {
|
||||||
|
|
||||||
|
if (playback.is_valid())
|
||||||
|
playback->seek(p_position);
|
||||||
|
}
|
||||||
|
|
||||||
Ref<Texture> VideoPlayer::get_video_texture() {
|
Ref<Texture> VideoPlayer::get_video_texture() {
|
||||||
|
|
||||||
if (playback.is_valid())
|
if (playback.is_valid())
|
||||||
|
@ -327,6 +333,7 @@ void VideoPlayer::_bind_methods() {
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_stream_name"), &VideoPlayer::get_stream_name);
|
ClassDB::bind_method(D_METHOD("get_stream_name"), &VideoPlayer::get_stream_name);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("set_stream_position", "position"), &VideoPlayer::set_stream_position);
|
||||||
ClassDB::bind_method(D_METHOD("get_stream_position"), &VideoPlayer::get_stream_position);
|
ClassDB::bind_method(D_METHOD("get_stream_position"), &VideoPlayer::get_stream_position);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_autoplay", "enabled"), &VideoPlayer::set_autoplay);
|
ClassDB::bind_method(D_METHOD("set_autoplay", "enabled"), &VideoPlayer::set_autoplay);
|
||||||
|
|
|
@ -93,6 +93,7 @@ public:
|
||||||
|
|
||||||
String get_stream_name() const;
|
String get_stream_name() const;
|
||||||
float get_stream_position() const;
|
float get_stream_position() const;
|
||||||
|
void set_stream_position(float p_position);
|
||||||
|
|
||||||
void set_autoplay(bool p_enable);
|
void set_autoplay(bool p_enable);
|
||||||
bool has_autoplay() const;
|
bool has_autoplay() const;
|
||||||
|
|
Loading…
Reference in a new issue