Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ python-mpv is using mpv via libmpv. libmpv is meant for embedding into other app
GUI features such as the OSD or keyboard input. To enable the built-in GUI, use the following options when initializing
the MPV instance. See `Issue 102`_ for more details

.. _`issue 102`: https://github.com/jaseg/python-mpv/issues/61
.. _`issue 102`: https://github.com/jaseg/python-mpv/issues/102

.. code:: python

Expand All @@ -284,6 +284,11 @@ the MPV instance. See `Issue 102`_ for more details
PyQT embedding
..............

On macOS, libmpv may hang when it tries to create its own window. In that case, create a native Qt window on the main
thread and pass its window id to ``MPV`` using ``wid``. Qt itself must run on the main thread; move the rest of your
application work to worker threads or processes instead of starting ``QApplication`` in a background thread. Also keep
the ``MPV`` instance referenced for as long as the window is alive.

.. code:: python

#!/usr/bin/env python3
Expand All @@ -300,11 +305,10 @@ PyQT embedding
self.setCentralWidget(self.container)
self.container.setAttribute(Qt.WA_DontCreateNativeAncestors)
self.container.setAttribute(Qt.WA_NativeWindow)
player = mpv.MPV(wid=str(int(self.container.winId())),
vo='x11', # You may not need this
self.player = mpv.MPV(wid=str(int(self.container.winId())),
log_handler=print,
loglevel='debug')
player.play('test.webm')
self.player.play('test.webm')

app = QApplication(sys.argv)

Expand Down Expand Up @@ -400,4 +404,3 @@ For details, see `the mpv copyright page`_.
.. _Robozman: https://gitlab.com/robozman
.. _dfaker: https://github.com/dfaker
.. _`the mpv copyright page`: https://github.com/mpv-player/mpv/blob/master/Copyright