多亏了
(
https://github.com/willprice/python-omxplayer-wrapper
)
from omxplayer import OMXPlayer
from time import sleep
/* Setup the player as shown in omxplayer-wrapper examples : */
source = '../video/gray10sec.mp4'
player = OMXPlayer(source, args=['--loop', '--no-osd', '--blank'])
player.pause()
sleep(5)
player.play()
/* Make a query to position() inside infinite loop : */
while (1):
position = player.position() * 1000
/* Event timecodes values are stored in "events" */
for event in events.values():
if position - 20 <= event['tc'] and position + 20 >= event['tc']:
/* Put your code here */
player.quit()