summaryrefslogtreecommitdiff
path: root/mpv.py
diff options
context:
space:
mode:
Diffstat (limited to 'mpv.py')
-rw-r--r--mpv.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/mpv.py b/mpv.py
index 19f3581..1efdeb1 100644
--- a/mpv.py
+++ b/mpv.py
@@ -1981,6 +1981,17 @@ class MPV(object):
yield write
q.put(EOF)
+ def play_bytes(self, data):
+ frame = sys._getframe()
+ stream_name = f'__python_mpv_play_generator_{hash(frame)}'
+
+ @self.python_stream(stream_name)
+ def reader():
+ yield data
+ reader.unregister() # unregister itself
+
+ self.play(f'python://{stream_name}')
+
def python_stream_catchall(self, cb):
""" Register a catch-all python stream to be called when no name matches can be found. Use this decorator on a
function that takes a name argument and returns a (generator, size) tuple (with size being None if unknown).