info-beamer

Display video via LUA

How do I play a video using LUA (my own package)?

I start by loading the file:

local videoDev = resource.load_video{file="development.mp4";audio=false;looped=true;paused=false;raw=true;}

But where do I place the code to show the video?

videoDev.place(50, 230, 700, 80)

Inside the node.render()? Does this cause the video to restart?

Preferably in node.render() or any of its callees. Reason is that the video placement requires knowledge of the video’s dimensions. Those on the other hand are not immediately available after loading a video: It just take a moment to parse the file and get that data. If you try to call place immediately after calling load_video(), the call will most likely have no effect.

If you call place() repeatedly within node.render(), at some point the required information will be available and the place call results in the video being placed on the screen. Calling place() each frame has almost no overhead.

No. The video playback will start once you call load_video (unless you’re using paused = true in which case playback is stopped at the first frame). The video will even play if you do not place it.

info-beamer - Digital Signage for the Raspberry Pi community forum - Imprint