Created
January 11, 2016 23:50
-
-
Save kakauandme/bc29732c7c54dc272b4d to your computer and use it in GitHub Desktop.
Loop videos gaplessly on Pi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/willprice/python-omxplayer-wrapper | |
from omxplayer import OMXPlayer | |
from time import sleep | |
args=['--no-osd' ] | |
files = ['videos/green.m4v', 'videos/red.m4v', 'videos/orange.m4v', 'videos/blue.m4v'] | |
durations = [] | |
players = [] | |
print('Initialising') | |
for f in files: | |
#OMXPlayer per file | |
players.append(OMXPlayer(f, args=args)) | |
#get duration of each file | |
durations.append(players[len(players)-1].duration()) | |
#just in case | |
sleep(2) | |
print('Playing') | |
#loop 5 times | |
for cnt in range(0,5): | |
#play each file | |
for i in range(0,len(players)): | |
players[i].set_position(0.0) | |
players[i].play() | |
# raspberry pi 2 | |
#sleep(durations[i] - 0.5) | |
# raspberry pi 1 | |
sleep(durations[i] - 1.5) | |
players[i].pause() | |
print('Quiting') | |
for p in players: | |
p.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment