DiscordPHP: Can't play a file with VoiceClient::playFile()

Environment

  • PHP Version:
    • 8.0.9
  • DiscordPHP Versions:
    • dev-develop
  • Ubuntu 21.04
  • FFmpeg

Describe the bug The bot joins my voice channel but plays no sound. There is no error and it looks like it can find the mp3 file. Also tried a .wav file.

Code

$discord->joinVoiceChannel($voiceChannel, false, false)->done(function(VoiceClient $voiceClient){
    $voiceClient->playFile("dt.mp3")->otherwise(function($e){ echo "ERROR: ".$e->getMessage(); });
});

Expected behavior Join a voice channel and play a sound.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Okay i’ve updated Discord-PHP and nothing changed. But, i had some problems running dca-v0.1.0-linux-amd64 due to missing permissions. I’ve added execution permissions on that file and now the bot can play sounds.

Thx! Let’s see if that’s a fix for the other devs 😃

Also, try running ./vendor/team-reflex/discord-php/bin/dca-v0.1.0-linux-amd64 in the root folder of your bot and see what the output is.