How to stop VideoStreamPlayer from hiding or vanishing when it finishes playing a video?

Godot Version

4.2.1

Question

I want to play a video everytime the game starts. I want the video to finish playing first, then when the video is done playing a start button appears on the bottom right corner of the video, and all the while in the background a song keeps playing on repeat even when the video is finished playing till the start button is pressed. Little bit like old pokemon games.

First I add a Control node, then I add a VideoStreamPlayer and an AudioStreamPlayer node, and a Button. The button is hidden at first and on the video player’s _on_finished signal the button is set to visible.

It works fine but the issue is the video disappears when the button appears or when the video is done playing and VideoStreamPlayer’s _on_finished signal is triggered.

I want the video player to stay there after the video has done playing till the start button is pressed, that video player acts like a background for the start button.

1 Like

i’m new to Godot and am trying to figure this out too. here’s something kinda hacky that worked for me:

  • add a print($VideoStreamPlayer.stream_position) to a script and play your scene once to see what the ending stream_position value of the video is
  • store that value in a variable video_length
  • in a _process function, check for $VideoStreamPlayer.stream_position >= video_length. when that returns true, call $VideoStreamPlayer.set_paused(true) and show the start button

having to hardcode the video’s length is the extra hacky part. it’d be nice to be able to programatically get the length, but it seems like right now VideoStreamPlayer.get_stream_length always returns 0 for Godot’s built-in video format.