Skip to reading
3D Models & Video in GUIs

22. Seek to a position in the clip

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

The embedded player exposes stream_position in seconds. This example requests a seek to half a second:

Code example
extends "res://scripts/runtime/script_base.gd"
Code example
func run(_context: Dictionary = {}) -> Variant:
    var player := GetGUIElementProperty(
        "video_lab", "briefing_video", "video_player", null
    ) as VideoStreamPlayer
    if player == null or player.stream == null:
        return false
    player.stream_position = 0.5
    return true

The sample Theora and MP4 clips accepted the 0.5-second seek test in this build. Seeking still depends on the stream implementation and the file. Check the actual frame, position and behavior on the target platform.

1. Play the clip, pause it and note the current frame.

2. Run the seek script, using a position inside the known clip duration.

3. Check the displayed frame and the player’s reported position.

4. Resume and confirm that playback continues from the intended point.

Use seconds, not frame numbers or a percentage. Stay within the clip’s duration and test backward as well as forward seeking before building a scrubber around it.

The general Seek Video action is for the movie manager’s player. It does not select briefing_video inside this GUI. Use this wrapper when you intend to control this particular embedded element.

Page 32 of 45Permalink
Go to page