From ab8b8b54772d06416abf3ae36724b5272cddd59d Mon Sep 17 00:00:00 2001 From: jaseg Date: Wed, 17 Aug 2016 23:21:19 +0200 Subject: Improve event handling, add message handling, add key binding foo --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 2a3b61c..a533ee3 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ import mpv def my_log(loglevel, component, message): print('[{}] {}: {}'.format(loglevel, component, message)) -player = mpv.MPV(log_handler=my_log, ytdl=True) +player = mpv.MPV(log_handler=my_log, ytdl=True, input_default_bindings=True, input_vo_keyboard=True) # Property access, these can be changed at runtime player.observe_property('time-pos', lambda _property, pos: print('Now playing at {:.2f}s'.format(pos))) @@ -39,6 +39,11 @@ player.loop = 'inf' # Option access, in general these require the core to reinitialize player['vo'] = 'opengl' +def my_q_binding(state, key): + if state[0] == 'd': + print('THERE IS NO ESCAPE') +player.register_key_binding('q', my_q_binding) + player.play('https://youtu.be/DLzxrzFCyOs') player.wait_for_playback() -- cgit