aaronkeit
Posts: 4
Joined: Thu Mar 13, 2014 6:04 am

Starting/quitting OMXplayer through GPIO input.

Wed May 28, 2014 3:52 am

I have a project that is using a Pi and omxplayer to play a specific video file in a public kiosk of sorts. Up until now I've used Pikeyd to launch omxplayer upon one keypress of a switch connected to gpio, and stop the playback through another switch attached to a separate gpio input.

For reason's I won't get in to I can only use one switch moving forward and I need to launch omxplayer when the switch is closed and maintain the playback as long as the switch remains closed. Once the switch is released I need omxplayer to quit and be ready to launch from the beginning of the video file again if the switch is again pressed.

I'm assuming a python script could handle something like this, but I am not really a programmer and don't have a lot of time to figure it out right now. This thread about triggering a camera from gpio looks like it might have some useful tips but Istill wouldn't know how to kill omxplayer upon release of the switch: http://www.raspberrypi.org/forums/viewt ... 5&p=399904

I understand there's something called Pexpect that can control other programs to a certain extent but I looked at it and it's beyond my abilities without some help. Is there anyone out there that could provide some sample code on how to do something like this? I'd be happy to paypal somebody $30 if you post a useable script in the next day or two.

thanks much.

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Starting/quitting OMXplayer through GPIO input.

Wed May 28, 2014 5:26 pm

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “General programming discussion”