【发布时间】:2020-07-24 00:17:14
【问题描述】:
当我通过我的机器人播放音频时,它听起来很糟糕,我有一个快速的互联网连接,那么这可能是什么原因造成的?我在 Raspberry Pi 3 上运行我的机器人。我使用 FFMpeg。 RPI 是否会以某种方式成为瓶颈。是我的代码吗?
我的代码的简化版本:
@client.command()
async def play(ctx):
channel = client.get_channel(ctx.message.author.voice.channel.id)
voice = await channel.connect()
if not voice.is_playing():
voice.play(await discord.FFMpegOpusAudio(source='/path/to/file'))
while voice.is_playing():
await asyncio.sleep(1)
discord.AudioSource.cleanup(str(ctx.message.author.voice.channel.id))
【问题讨论】:
-
你在哪里下载视频?
-
我使用名为 pafy 的库从 youtube 下载视频。
标签: python-3.x ffmpeg discord.py