aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-12-09 18:01:14 -0500
committerRapptz <[email protected]>2015-12-09 18:01:14 -0500
commit3ca584556659bf2529da16a2684a7cbfc216ccc5 (patch)
treebc7b49df4e71edb50203317d727b467f698bfa2c
parentClear up documentation on passing discord.Object (diff)
downloaddiscord.py-3ca584556659bf2529da16a2684a7cbfc216ccc5.tar.xz
discord.py-3ca584556659bf2529da16a2684a7cbfc216ccc5.zip
Close ffmpeg process after stream is finished.
-rw-r--r--discord/voice_client.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/discord/voice_client.py b/discord/voice_client.py
index 3ecc990a..e31e8f87 100644
--- a/discord/voice_client.py
+++ b/discord/voice_client.py
@@ -349,7 +349,12 @@ class VoiceClient:
except Exception as e:
raise ClientException('Popen failed: {0.__name__} {1}'.format(type(e), str(e)))
- return StreamPlayer(process.stdout, self.encoder, self._connected, self.play_audio, after)
+ def killer():
+ process.kill()
+ if callable(after):
+ after()
+
+ return StreamPlayer(process.stdout, self.encoder, self._connected, self.play_audio, killer)
def encoder_options(self, *, sample_rate, channels=2):
"""Sets the encoder options for the OpusEncoder.