Skip to content

bug: await VoiceClient.disconnect() raise OSError: [WinError 10038] when passing a str that represent a non file-like object #846

Open
@Snipy7374

Description

@Snipy7374

Summary

When using a FFmpegPCMAudio audio source with a source that represent a non file-like object (e.g a url) and when disconnecting from a VoiceChannel you get an OSError.

This bug was found while trying to test more

Reproduction Steps

Connect to a VoiceChannel
Start playing something using FFmpegPCMAudio as audio source with a source that does't represent a file-like object
Disconnect from the VoiceChannel using await VoiceClient.disconnect()

Minimal Reproducible Code

@bot.slash_command()
async def test(inter):
    channel: disnake.VoiceChannel = await bot.fetch_channel(874005538285977603)
    vc = await channel.connect()
    vc.play(disnake.FFmpegPCMAudio("https://github.com/ninjamuffin99/Funkin/blob/a083938ac803a91fbb15f03e432dea620f8a3b4a/assets/songs/bopeebo/Inst.mp3?raw=true", executable="C:\\Users\\user\\LMAOGOTIT\\Desktop\\ffmpeg-master-latest-win64-gpl-shared\\bin\\ffmpeg.exe"))
    print(f"playing: {vc.is_playing()} paused: {vc.is_paused()}")
    await asyncio.sleep(2)
    vc.stop()
    await vc.disconnect()

Expected Results

The bot should disconnect from the VoiceChannel succesfully without raising any error

Actual Results

The bot raise an error, full traceback below:

Exception in voice thread Thread-3
Traceback (most recent call last):
  File "C:\Coding prog\lib\site-packages\disnake\player.py", line 746, in run
    self._do_run()
  File "C:\Coding prog\lib\site-packages\disnake\player.py", line 739, in _do_run
    play_audio(data, encode=not self.source.is_opus())
  File "C:\Coding prog\lib\site-packages\disnake\voice_client.py", line 686, in send_audio_packet
    self.socket.sendto(packet, (self.endpoint_ip, self.voice_port))
OSError: [WinError 10038] an operation was attempted on something that is not a socket

Intents

Irrelevants

System Information

Windows 11 Version 21H2 -- Build SO 22000.1098
Disnake 2.7.0

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

I think that the problem is related to the stream of bytes coming from FFmpeg or some bug/problem occurred while trying to stop the stream

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmed bugSomething might not be working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions