Can VideoPlayer render to a sprite?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By johnburkert

Is it possible to render video on a sprite or quad? If so, is there an example?

:bust_in_silhouette: Reply From: funabab

This can be achieved by using a viewport node.
Add a videoplayer node as a child of a viewport node and use the viewport texture as the texture of the sprite.
You can check the Viewport demos or a demo scene i have prepared (3.x) Dropbox - ViewportVideoDemo.rar - Simplify your life

Thanks for the reply. I ended up going with this:

var video = VideoPlayer.new()
video.stream = load("res://video.ogv")
var sprite = Sprite.new()
sprite.add_child(video)
sprite.set_texture(video.get_video_texture())

johnburkert | 2018-04-25 18:20