diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2017-10-04 18:03:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-04 18:03:13 +0200 |
commit | 7c2cda72b859509758f43e60fee6798b6175590b (patch) | |
tree | 22e2beca34a4a52cb6f5bdc63bc1bb233897efb6 /scene/gui/video_player.cpp | |
parent | ef08228db738ea731a975c986ccf4da873930fbd (diff) | |
parent | 43410ca363da329313bc9ca74882a4409335a306 (diff) |
Merge pull request #11816 from terahxluna/video_player_set_stream_position
Add function set_stream_position to VideoPlayer. Closes #8727
Diffstat (limited to 'scene/gui/video_player.cpp')
-rw-r--r-- | scene/gui/video_player.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/scene/gui/video_player.cpp b/scene/gui/video_player.cpp index 816556af30..190ccd50d5 100644 --- a/scene/gui/video_player.cpp +++ b/scene/gui/video_player.cpp @@ -285,6 +285,12 @@ float VideoPlayer::get_stream_position() const { 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() { 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("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("set_autoplay", "enabled"), &VideoPlayer::set_autoplay); |