[Bug]: Changing voice channel throws OperationCancelledException
josago97 opened this issue · 0 comments
josago97 commented
Check The Docs
- I double checked the docs and couldn't find any useful information.
Verify Issue Source
- I verified the issue was caused by Discord.Net.
Check your intents
- I double checked that I have the required intents.
Description
I've been following the streaming audio library tutorial available here. While the audio streaming, if the bot changes voice channel then the stream is interrupted throwing an OperationCancelledException error. In previous versions this did not happen and was managed correctly.
Version
3.11.0
Working Version
No response
Logs
The operation was canceled.
at System.Threading.CancellationToken.ThrowOperationCanceledException()
at System.Threading.SemaphoreSlim.d__31.MoveNext()
at Discord.Audio.Streams.BufferedWriteStream.d__22.MoveNext()
at Discord.Audio.Streams.OpusEncodeStream.d__8.MoveNext()
at System.IO.Stream.<g__Core|29_0>d.MoveNext()
Sample
using (var ffmpeg = CreateStream(path))
using (var output = ffmpeg.StandardOutput.BaseStream)
using (var discord = client.CreatePCMStream(AudioApplication.Mixed))
{
await output.CopyToAsync(discord); // OperationCancelledException here
await discord.FlushAsync();
}
Packages
NET 6.0