The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+1 vote

Hi,

I got the videoplayer to load my video.
I turn off "autoplay" in inspector

When I run the game, the video doesn't play, as I expected.

But there are no VCR-like controls to play/pause/stop etc.
Where is that setting??

Also, when I export a game to windows exe, does the video require any special run times or codecs's to be on the pc... in other words is the game dependent on user's pc having any required programs (Media player etc) or are they required to install any prerequisites before using the game.

Thanks

in Engine by (54 points)
retagged by

1 Answer

+1 vote

If you want video controls in your game, you'll have to make them with Control nodes such as Buttons. You can attach them to VideoPlayer methods (ie play() and stop()).

No, the user doesn't need anything installed for Godot to work. Video (Webm and Ogg Theora) libraries are built in.

by (22,191 points)

Okay... I made a play and stop button.... that works okay.

One problem.

I really need a pause button that pauses the video so when the user presses the Play button again it will continue where it was paused.

However, currently with my stop button. If i press play again, it starts the video over from the beginning... that is not what i need. I need it to play from where i stopped (or paused) it.

Can that be done?

Thanks

The VideoPlayer docs contain all the information you need. In this case, the paused property.

I read that... very basic and not much info.
Doesn't explain my situation at all.

I tried just using "pause" but clicking play starts the video over from beginning.

UPDATED
THIS IS WORNG... see below post

Sorry... mis-spoke... this code doesn't even work,,,

VideoPlayer.pause

Here is what I have for code for play and pause buttons

func _on_Button_pressed():
    $CanvasLayer/VideoPlayer.play()

func _on_Pause_pressed():
    #$CanvasLayer/VideoPlayer.stop()
    $CanvasLayer/VideoPlayer.paused

I tried this... and it paused the video.

$CanvasLayer/VideoPlayer.set_paused(true)

Now if I can get the play to work right

Okay.... figured it out...

The play and pause buttons both work.

func _on_Button_pressed():
    if $CanvasLayer/VideoPlayer.is_paused():
       $CanvasLayer/VideoPlayer.set_paused(false)
    else:
        $CanvasLayer/VideoPlayer.play()

func _on_Pause_pressed():
    $CanvasLayer/VideoPlayer.set_paused(true)

Good work. FYI, set/get are not necessary for object properties:

func _on_Button_pressed():
    if $CanvasLayer/VideoPlayer.paused:
       $CanvasLayer/VideoPlayer.paused = false
    else:
        $CanvasLayer/VideoPlayer.play()

func _on_Pause_pressed():
    $CanvasLayer/VideoPlayer.paused = true

Okay. That works too.

Thanks

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.