commit 69b2fe7e9033de971777b31b09997ec80487ebee Author: David Rice Date: Thu Mar 12 13:27:02 2026 +0000 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..456b38d --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Introduction +NEXIO DISPLAY TEST - PYTHON APP FOR NEXIO DISPLAY TESTING diff --git a/arrive_vidplybck.py b/arrive_vidplybck.py new file mode 100644 index 0000000..2d54ffe --- /dev/null +++ b/arrive_vidplybck.py @@ -0,0 +1,59 @@ +import gi +import sys + +gi.require_version('Gst', '1.0') +from gi.repository import Gst, GLib + +def play_kiosk_video(): + Gst.init(None) + + VIDEO_PATH = "file:///root/python/vid.mp4" + + SINK_STR = ( + "videoconvert ! " + "video/x-raw,format=BGRx ! " + "kmssink driver-name=mxsfb-drm connector-id=37 plane-id=31 can-scale=false" ) + + # Create the playbin element + pipeline = Gst.ElementFactory.make("playbin", "player") + pipeline.set_property("uri", VIDEO_PATH) + + # Set the custom video sink + video_sink = Gst.parse_bin_from_description(SINK_STR, True) + pipeline.set_property("video-sink", video_sink) + + # Set audio to fakesink (prevents errors if no audio hardware is found) + audio_sink = Gst.ElementFactory.make("fakesink", "audio-fake") + pipeline.set_property("audio-sink", audio_sink) + + # --- LOOPING LOGIC --- + bus = pipeline.get_bus() + bus.add_signal_watch() + + def on_message(bus, msg): + t = msg.type + if t == Gst.MessageType.EOS: + print("End of video. Looping...") + pipeline.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, 0) + elif t == Gst.MessageType.ERROR: + err, debug = msg.parse_error() + print(f"Error: {err}") + loop.quit() + return True + + bus.connect("message", on_message) + + # Start playback + print(f"Starting playback: {VIDEO_PATH}") + pipeline.set_state(Gst.State.PLAYING) + + loop = GLib.MainLoop() + try: + loop.run() + except KeyboardInterrupt: + print("\nStopping player...") + finally: + pipeline.set_state(Gst.State.NULL) + +if __name__ == "__main__": + play_kiosk_video() diff --git a/vid.mp4 b/vid.mp4 new file mode 100644 index 0000000..b3de526 Binary files /dev/null and b/vid.mp4 differ