I'm using the omxplayer-wrapper to run video files from python script.
How can I run files according to the pressed buttons?
I want play file "a.mp4" until Button1 was pressed.
After Button1 pressed, I need to play file "b.mp4" and when it finished to play, I need to run the file "a.mp4" until Button2 was pressed.
After Button2 pressed, I need to play file "c.mp4" and when it finished to play, I need to run the file "a.mp4".
When I'm doing something similar to pseudo code example (below), I get the right behavior but I see the desktop for 1 second between the b.mp4 and a.mp4 files (after b was finished) and between c and a (after c was finished) it's 10-12 seconds.
What the proper way to do it?
Thanks a lot!!
Example pseudo code:
from omxplayer import OMXPlayer from time import sleep playerA = OMXPlayer('path/to/a.mp4', args=['-b', '--loop']) playerB = OMXPlayer('path/to/b.mp4', args=['-b']) playerC = OMXPlayer('path/to/c.mp4', args=['-b']) playerA.play() while True: if Button1PressedFlag==True: #set in interrupt Button1PressedFlag=False playerA.pause() playerB.play() while playerB.is_playing(): sleep(0.2) playerB.quit() playerA.play() if Button2PressedFlag==True: #set in interrupt Button2PressedFlag=False playerA.pause() playerC.play() while playerC.is_playing(): sleep(0.2) playerC.quit() playerA.play()