discord-php / DiscordPHP

An API to interact with the popular messaging app Discord
MIT License
1k stars 237 forks source link

Not able to play audio from mp3 #955

Closed MP0501 closed 1 year ago

MP0501 commented 2 years ago

Hey, whenever I try to play a mp3 File my bot does nothing. I use the following code: $bot->joinVoiceChannel($channeltoJoin, false, false)->then( function (VoiceClient $voice) { $voice->playFile(__DIR__ . "./downloads/song.mp3"); } );

I also get no Error in my console except, that the session is no longer valid.

Warning: Undefined array key 700390191008841858 in D:\Dokumente\php projects\mikachubot\bot.php on line 42 [2022-10-22T23:31:03.435604+02:00] DiscordPHP.INFO: received token and endpoint for voice session {"guild":"700390191008841858","token":"f6236ff3278c79df","endpoint":"rotterdam4472.discord.media:443"} [] [2022-10-22T23:31:04.265475+02:00] DiscordPHP.DEBUG: connected to voice websocket [] [] PHP Warning: Undefined array key "session" in D:\Dokumente\php projects\mikachubot\vendor\team-reflex\discord-php\src\Discord\Voice\VoiceClient.php on line 577

Warning: Undefined array key "session" in D:\Dokumente\php projects\mikachubot\vendor\team-reflex\discord-php\src\Discord\Voice\VoiceClient.php on line 577 [2022-10-22T23:31:04.268304+02:00] DiscordPHP.DEBUG: sending identify {"packet":{"op":0,"d":{"server_id":"700390191008841858","user_id":"1033155727352672267","session_id":null,"token":"f6236ff3278c79df"}}} [] [2022-10-22T23:31:04.269327+02:00] DiscordPHP.DEBUG: sending heartbeat [] [] [2022-10-22T23:31:04.347498+02:00] DiscordPHP.DEBUG: received heartbeat ack {"response_time":78.21083068847656} [] [2022-10-22T23:31:04.348418+02:00] DiscordPHP.WARNING: voice websocket closed {"op":4006,"reason":"Session is no longer valid."} [] [2022-10-22T23:31:04.348716+02:00] DiscordPHP.WARNING: received critical opcode - not reconnecting {"op":4006,"reason":"Session is no longer valid."} [] [2022-10-22T23:31:04.348998+02:00] DiscordPHP.WARNING: voice client closed [] [] [2022-10-22T23:31:23.539907+02:00] DiscordPHP.DEBUG: sending heartbeat {"seq":6} [] [2022-10-22T23:31:23.721016+02:00] DiscordPHP.DEBUG: received heartbeat ack {"response_time":180.50384521484375} []

Is there any solution for this problem?

I'm using PHP 8.1 and DiscordPHP v7.3.1

key2peace commented 2 years ago

kannste nochmal probieren mit dem aktuellen dev-master?