-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tkinter embedding: mpv.terminate() hangs when observe_property has been added to time-pos #114
Comments
Inspecting the output of _event_generator in this scenario shows that that final event generated is a 22 property change, event 1 for shutdown never makes it through the pipe and no NONE 0 event is sent either, the grim_reaper will therefore I think wait forever blocking exit. |
If it is seemingly an issue that the shutdown command is never sent at least giving an option to pass daemonic_reaper to terminate as |
There were some issues around multithreading and import tkinter as tk
import mpv
root=tk.Tk()
player = mpv.MPV(wid=str(int(root.winfo_id())), vo='x11')
player.play('test.webm')
def handlePropertyChange(name,value):
print('property change',name,value)
root.title(str(value))
player.observe_property('time-pos', handlePropertyChange)
tk.mainloop()
print('calling player.terminate.')
player.quit()
print('terminate player.returned.') When using
I'm not sure where that is coming from. If you can, just calling |
Thanks! I'll pull these and report back. |
I had the same issue in linux (Ubuntu 20.04) and pyqt5.
Main thread (which mpv player is defined and started in):
|
@m44soroush I'm glad that your workaround functions, but it would be interesting to see why this happened. Do you think you could get a stack trace of the hanging code? Python should spit out a stack trace if you just Ctrl+C, and you can get a stack trace of mpv's threads by running python inside gdb via |
Reproducible on windows 10 with python-mpv 0.4.6 and mpv-dev-x86_64-20200426-git-640db1e, the last print statement in this snippet is never reached:
The same behaviour isn't noted if
osd-width
orduration
is observed, additionally placing aplayer.unobserve_property('time-pos', handlePropertyChange)
directly before player.terminate() has no effect, however removing it ahead of time,presumably giving enough time for the event queue to empty does seem to work:Does the event loop stop working when the frame with the wid passed to mpv is destroyed?
The text was updated successfully, but these errors were encountered: