0 votes

I have a Video Player that plays four different videos after clicking one of four corresponding buttons. When I switch videos there is a short, 2-3 second pause with a black screen before the next video loads. When a video loops, there is a short pause with a grey screen.

Is it possible to play videos without the delay?

extends Control

var pose1 = preload("res://pose1.ogv")
var pose2 = preload("res://pose2.ogv")
var pose3 = preload("res://pose3.ogv")
var pose4 = preload("res://pose4.ogv")

var video_player
var video

func _ready():
    video_player = get_node("VideoPlayer")

    get_node("Button1").connect("pressed",self,"_on_button1_pressed")
    get_node("Button2").connect("pressed",self,"_on_button2_pressed")
    get_node("Button3").connect("pressed",self,"_on_button3_pressed")
    get_node("Button4").connect("pressed",self,"_on_button4_pressed")

    set_process (true)

func _on_button1_pressed():
    video = pose1
    video_player.set_stream(video)

func _on_button2_pressed():
    video = pose2
    video_player.set_stream(video)

func _on_button3_pressed():
    video = pose3
    video_player.set_stream(video)

func _on_button4_pressed():
    video = pose4
    video_player.set_stream(video)

func _process(delta):
    if not video_player.is_playing():
        video_player.play()
in Engine by (27 points)

What if you make four video players, set them all to their corresponding video in _ready, and then make the one that needs to be shown active?

Please log in or register to answer this question.

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.