You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class MpvWidget(QWidget):
def __init__(self, parent=None):
super().__init__(parent)
self.player = MPV(
wid=str(int(self.winId())),
log_handler=None,
loglevel='debug'
)
# if i use this method, MpvWidget will not call __del__
self.mpv.observe_property(
'time-pos',
lambda name, position: self._on_position_changed(position)
)
def __del__(self):
self.player.terminate()
The text was updated successfully, but these errors were encountered:
lzy-zj
changed the title
a problem when working with pyqt5
When should I call this method ‘mpv.terminate()’
Nov 20, 2024
You don't have to call terminate at all in this case. The underlying mpv instance is automatically destroyed when the MPV object is garbage collected. You only have to call terminate yourself when for some reason you want libmpv to release resources like window handles or when using OpenGL before the MPV object is automatically garbage collected.
for example:
The text was updated successfully, but these errors were encountered: