forked from Pro-Use/pyOmxSync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_master.py
36 lines (28 loc) · 865 Bytes
/
test_master.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python2
try:
from omxplayer import OMXPlayer
except ImportError:
print("\n!! Could not import OMXPlayer, see https://github.com/willprice/python-omxplayer-wrapper for install instructions !!\n")
from omxsync import Broadcaster
import sys
if len(sys.argv) < 2:
print('No video specified\nUsage: python test_master.py path/to/video.mp4\n')
sys.exit(1)
try:
print("Load player")
player = OMXPlayer(sys.argv[1])
print("Load broadcaster")
broadcaster = Broadcaster(player, {'verbose': True})
broadcaster.setup()
print("Start playing")
player.play()
while player.playback_status() != "Stopped":
broadcaster.update()
print("Stop player")
player.stop()
print("Exit")
except KeyboardInterrupt:
player.quit()
except Exception as err:
print("An error occured:")
print(err)