Skip to reading
3D Models & Video in GUIs

25. Change the clip or its settings

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
Code example
extends "res://scripts/runtime/script_base.gd"
Code example
func run(_context: Dictionary = {}) -> Variant:
    await ChangeGUIElementProperty({
        "guiId": "video_lab",
        "elementId": "briefing_video",
        "property": "assetId",
        "value": "workshop_clip"
    })
    var player := GetGUIElementProperty(
        "video_lab", "briefing_video", "video_player", null
    ) as VideoStreamPlayer
    if player == null or player.stream == null:
        return false
    player.paused = false
    player.play()
    return true

Changing assetId applies the new definition and loads the new stream. Obtain the player and check its stream before issuing the next playback command.

Other Video property changes also reapply the definition in this build. That can stop the current clip, restore authored Loop and Muted values and request Autoplay again. Do not use repeated property edits as a way to animate a movie’s volume or progress every frame.

Source table from 25. Change the clip or its settings, page 35
ChangeUseful approach
A different clipChange assetId, check the new stream, then play deliberately.
Live player volumeUse the obtained player’s volume_db.
Pause / resumeUse the player’s paused flag.
Background imageSet up the appearance before playback when possible.
Page 35 of 45Permalink
Go to page