{"action":"created","issue":{"url":"https://api.github.com/repos/jaseg/python-mpv/issues/61","repository_url":"https://api.github.com/repos/jaseg/python-mpv","labels_url":"https://api.github.com/repos/jaseg/python-mpv/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/jaseg/python-mpv/issues/61/comments","events_url":"https://api.github.com/repos/jaseg/python-mpv/issues/61/events","html_url":"https://github.com/jaseg/python-mpv/issues/61","id":283220277,"number":61,"title":"Stuck in threading on macOS","user":{"login":"kpj","id":645279,"avatar_url":"https://avatars0.githubusercontent.com/u/645279?v=4","gravatar_id":"","url":"https://api.github.com/users/kpj","html_url":"https://github.com/kpj","followers_url":"https://api.github.com/users/kpj/followers","following_url":"https://api.github.com/users/kpj/following{/other_user}","gists_url":"https://api.github.com/users/kpj/gists{/gist_id}","starred_url":"https://api.github.com/users/kpj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kpj/subscriptions","organizations_url":"https://api.github.com/users/kpj/orgs","repos_url":"https://api.github.com/users/kpj/repos","events_url":"https://api.github.com/users/kpj/events{/privacy}","received_events_url":"https://api.github.com/users/kpj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-12-19T13:00:46Z","updated_at":"2017-12-26T09:50:01Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\n\r\nconsider the following code:\r\n```python\r\nimport mpv\r\n\r\n_url = 'test.webm'\r\nmpv = mpv.MPV()\r\nmpv.loadfile(_url)\r\nprint('waiting')\r\nmpv.wait_for_playback()\r\nprint('done')\r\n```\r\n\r\nOn Linux, this will print `waiting`, then play `test.webm`, and finally print `done` as expected.\r\n\r\nOn macOS 10.12.6 using Python 3.6 and MPV 0.27 however, it only prints `waiting` and is then stuck forever while the Python-Rocket starts jumping in my Dock.\r\n\r\nI looked into python-mpv's code, and for `mpv.wait_for_playback()` it is stuck in [line 557](https://github.com/jaseg/python-mpv/blob/master/mpv.py#L557), which is:\r\n```python\r\nself._playback_cond.wait()  # _playback_cond is threading.Condition\r\n```\r\nUsing `mpv.wait_for_property('filename', lambda x: x is None)` instead, makes it stuck in [line 569](https://github.com/jaseg/python-mpv/blob/master/mpv.py#L569), which is:\r\n```python\r\nsema.acquire()  # sema is threading.Semaphore\r\n```\r\n\r\nThe problem thus seems to somehow be related to the handling of the `threading` library.\r\nDo you have any suggestion what might be causing this?\r\n\r\nThis is also possibly a duplicate of #59."},"comment":{"url":"https://api.github.com/repos/jaseg/python-mpv/issues/comments/353947725","html_url":"https://github.com/jaseg/python-mpv/issues/61#issuecomment-353947725","issue_url":"https://api.github.com/repos/jaseg/python-mpv/issues/61","id":353947725,"user":{"login":"jaseg","id":136313,"avatar_url":"https://avatars3.githubusercontent.com/u/136313?v=4","gravatar_id":"","url":"https://api.github.com/users/jaseg","html_url":"https://github.com/jaseg","followers_url":"https://api.github.com/users/jaseg/followers","following_url":"https://api.github.com/users/jaseg/following{/other_user}","gists_url":"https://api.github.com/users/jaseg/gists{/gist_id}","starred_url":"https://api.github.com/users/jaseg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaseg/subscriptions","organizations_url":"https://api.github.com/users/jaseg/orgs","repos_url":"https://api.github.com/users/jaseg/repos","events_url":"https://api.github.com/users/jaseg/events{/privacy}","received_events_url":"https://api.github.com/users/jaseg/received_events","type":"User","site_admin":false},"created_at":"2017-12-26T09:50:01Z","updated_at":"2017-12-26T09:50:01Z","author_association":"OWNER","body":"Yep, wid is effectively passed in as a command line option. See also [this upstream example](https://github.com/mpv-player/mpv-examples/blob/master/libmpv/cocoa/cocoabasic.m).\r\n\r\nAccording to the README of [the upstream examples](https://github.com/mpv-player/mpv-examples/tree/master/libmpv) a caveat seems to be that this way of embedding is not very stable, so you might also try embedding via OpenGL instead. The callbacks are supported by python-mpv. [Upstream issue #556](https://github.com/mpv-player/mpv/issues/556) gives some detail on mpv GUI initialization on OSX, though it still doesn't explain the hang observed here.\r\n\r\nI would like to avoid putting PyQT-specific code into python-mpv. Since getting that up and running is very simple (3loc) I'd keep it in the README examples for now. For now, I think two things to add there are a) an OpenGL callback example and b) a hint to OSX users to create their own window.\r\n\r\nAs for proper debugging, yes, that would be great. However, I don't have an Apple machine so you or one of the other OSX users would have to do most of that. And given what [upstream issue #556](https://github.com/mpv-player/mpv/issues/556) says we might well find out that maybe on OSX embedding is only supported if you bring your own window."}}
{"actor":{"display_login":"jaseg"}}