+4 votes

Hey guys! Converting my.. 30k LOC HTML 5 Game over to Godot.

Working on my intro screen right now, looks like Godot only likes Ogg Vorbis video files which is fine.

Having an issue here

enter image description here

Basically, was looking over the methods for VideoPlayer and cannot find anything that would set the video to loop. I tried Autoplay, which works, but was just curious if this is something the Godot team might support or do we need to build our own function?

King Regards,

in Engine by (299 points)

Hey guys, I got something going:

extends VideoPlayer
func _process(delta):
    var isPlaying = is_playing()
    if isPlaying == false:
        play()

    pass

func _ready():
    # Called every time the node is added to the scene.
    # Initialization here
    set_process(true)


    set_autoplay(true)
    print('Autoplay set to true')

    print(has_autoplay())
    pass

Problem is, there is a slight delay (1-2 seconds) when the video re-starts and it's not seamless. Hmm... Any idea?

3 Answers

0 votes

Check if this help (script attached to parent of VideoPlayer).

var video_player
var video

func _ready():
    video_player = get_node("Panel/VideoPlayer")
    video = preload("res://video.ogv")
    video_player.set_stream( video )
    set_process( true )

func _process(delta):
    if not video_player.is_playing():
    video_player.play()

Edit: WTF Is wrong with markdown here? Code blocks ``` don't want to work

by (360 points)
edited by

You mean, GitHub Flavoured Markdown ;)

No, every Markdown I've been using. Gihub's one have some nice features but I think backticks are "standard" http://commonmark.org/

0 votes

To get exactly what you need, following your code posted:

extends VideoPlayer        

func _ready(): #{           
    set_process(true)
#}

func _process(delta): #{
    if not is_playing():
        play()
#}

I'm a bit late... hope this helps someone else.

by (16 points)
0 votes

Attach this to VideoPlayer node:

extends VideoPlayer

func _ready():
    self.connect("finished", self, "_on_Finished")
    self.set_process(false)
    self.set_physics_process(false)

func _on_Finished():
    play()
by (163 points)
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 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 webmaster@godotengine.org with your username.

Categories