Fixed a bug that could deadlock the player

This commit is contained in:
Christoph Stahl 2024-11-15 22:20:49 +01:00
parent 02e77662ac
commit a99679eda5
2 changed files with 3 additions and 0 deletions

View file

@ -154,6 +154,7 @@ class Source(ABC):
"mpv", "mpv",
*args, *args,
stdout=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
) )
return await mpv_process return await mpv_process
@ -306,6 +307,7 @@ class Source(ABC):
self.downloaded_files[entry.ident].audio, self.downloaded_files[entry.ident].audio,
*extra_options, *extra_options,
) )
await self.player.communicate()
await self.player.wait() await self.player.wait()
self.player = None self.player = None
if self._skip_next: if self._skip_next:

View file

@ -257,6 +257,7 @@ class YoutubeSource(Source):
"--fullscreen", "--fullscreen",
mpv_options, mpv_options,
) )
await self.player.communicate()
await self.player.wait() await self.player.wait()
else: else:
await super().play(entry, mpv_options) await super().play(entry, mpv_options)