darkhz / invidtui

A TUI based Invidious client
MIT License
191 stars 6 forks source link

Closing mpv closes the whole application #16

Closed LupSpie closed 1 year ago

LupSpie commented 1 year ago

Hello, I've just found this project and I absolutely love it! One small issue that I have with it though is that when you close the player through MPV it closes the whole application instead of just closing MPV like it does when pressing shift + s on the terminal.

I've also seen https://github.com/darkhz/invidtui/commit/34ad4bb82b869d58343ca412acce16a2f5bdaa44, so I presume this is unexpected behavior that should not be happening?

Anyways, I hope this can get fixed :smile:

darkhz commented 1 year ago

The reason invidtui also closes when MPV exits is because MPV is no longer listening to a socket anymore, so media playback wont work unless MPV is restarted with the correct parameters and socket path. This behavior is intentional.

For now, I propose just minimizing MPV (or controlling all media based operations via invidtui instead of MPV) while you use invidtui, since MPV will automatically switch between video and audio modes according to the media type (I'm assuming you attempt to exit the MPV player after watching a video, since that is the only time MPV's GUI is exposed to the user). For example, if you've just finished playing a video, and an audio-only media is next in your playlist, MPV's video player will automatically close.

I will work on a fix in the coming month, since I'm actively working on another project. Perhaps someone can file a PR by then? I'd be happy to merge it (after testing the patch, of course). A possible solution is to use a loop, launch MPV with parameters, wait for exit, and relaunch it again. Or perhaps if there's a setting in MPV that prevents it from exiting when the GUI is closed, that would be useful. An issue could be filed with MPV's git repo.

(Also, https://github.com/darkhz/invidtui/commit/34ad4bb82b869d58343ca412acce16a2f5bdaa44 is not related to this.)

LupSpie commented 1 year ago

(Also, https://github.com/darkhz/invidtui/commit/34ad4bb82b869d58343ca412acce16a2f5bdaa44 is not related to this.)

Ah, forgive me then. I read https://github.com/darkhz/invidtui/issues/5#issuecomment-1194155084, and subsequent commit, and ended up misunderstanding it as being related to my issue.