summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2016-08-17 23:21:19 +0200
committerjaseg <code@jaseg.net>2016-08-17 23:21:19 +0200
commitab8b8b54772d06416abf3ae36724b5272cddd59d (patch)
tree72654ad5a469d65243f25976aefc186c38879b8d /README.md
parentde7b6711035a187492f9753fc8808d9c2ad1dd55 (diff)
downloadpython-mpv-ab8b8b54772d06416abf3ae36724b5272cddd59d.tar.gz
python-mpv-ab8b8b54772d06416abf3ae36724b5272cddd59d.tar.bz2
python-mpv-ab8b8b54772d06416abf3ae36724b5272cddd59d.zip
Improve event handling, add message handling, add key binding foo
Diffstat (limited to 'README.md')
-rw-r--r--README.md7
1 files changed, 6 insertions, 1 deletions
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()