diff options
| author | Rapptz <[email protected]> | 2015-12-09 18:01:14 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2015-12-09 18:01:14 -0500 |
| commit | 3ca584556659bf2529da16a2684a7cbfc216ccc5 (patch) | |
| tree | bc7b49df4e71edb50203317d727b467f698bfa2c | |
| parent | Clear up documentation on passing discord.Object (diff) | |
| download | discord.py-3ca584556659bf2529da16a2684a7cbfc216ccc5.tar.xz discord.py-3ca584556659bf2529da16a2684a7cbfc216ccc5.zip | |
Close ffmpeg process after stream is finished.
| -rw-r--r-- | discord/voice_client.py | 7 |
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. |