Pauses between videos

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Jambers
:warning: Old Version Published before Godot 3 was released.

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()

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?

raymoo | 2017-07-09 23:02