forked from willprice/python-omxplayer-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadvanced_usage.py
More file actions
executable file
·34 lines (23 loc) · 780 Bytes
/
Copy pathadvanced_usage.py
File metadata and controls
executable file
·34 lines (23 loc) · 780 Bytes
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
#!/usr/bin/env python3
from omxplayer.player import OMXPlayer
from pathlib import Path
from time import sleep
import logging
logging.basicConfig(level=logging.INFO)
VIDEO_1_PATH = "../tests/media/test_media_1.mp4"
player_log = logging.getLogger("Player 1")
player = OMXPlayer(VIDEO_1_PATH,
dbus_name='org.mpris.MediaPlayer2.omxplayer1')
player.playEvent += lambda _: player_log.info("Play")
player.pauseEvent += lambda _: player_log.info("Pause")
player.stopEvent += lambda _: player_log.info("Stop")
# it takes about this long for omxplayer to warm up and start displaying a picture on a rpi3
sleep(2.5)
player.set_position(5)
player.pause()
sleep(2)
player.set_aspect_mode('stretch')
player.set_video_pos(0, 0, 200, 200)
player.play()
sleep(5)
player.quit()