Pause/play functionality when displaying a video on an RGB LED Matrix

Hi everyone.
I’m currently using a RPi4 and the compiled awesome video-viewer from the utils folder. It all works fine.

I’d like to be able to pause whatever is playing on the matrix, with a toggle switch. So when I toggled down the switch, it would stop the video and stay paused on that frame, until I toggled the switch back up, witch should make the video continue playing.
The code that would handle the GPIO - toggle switch I can figure out, but I don’t know enough to add the play/pause functionality I want to video_viewer.cc
Can someone give me a hint?
Or if I’m looking at it wrong, please let me know.

I also thought of using python, but there isn’t a video-viewer.py in the bindings/python/samples folder that I can adapt to my needs.

My first try to solve this was to pause/continue the unix process with 'kill -STOP but that sends it to the bg, and stops displaying the video on the matrix until I ‘kill - CONT ’, so it’s not something I can use.

Thanks!

you’ll have to modify/edit the video viewer code