AudioPlayer goes from buffering -> playing -> idle and warns that resource is not playable

Hi, I have troubles for the last months with playback of resources. The source is available at https://github.com/manuel-rw/jellyfin-discord-music-bot Even though the stream URL seems correct to me, the bot goes into idle after a few milliseconds and it stays silent in Discord. I have tried different variations of the stream URL but they dont' seem to change anything. It used to work fine - I did not make an update of discord.js in the mean time. The code playing for resources is distributed, but let me summarise it shortly:
playResource(resource: AudioResource<unknown>) {
this.logger.debug(
`Playing audio resource with volume ${resource.volume?.volume} (${resource.playbackDuration}) (readable: ${resource.readable}) (volume: ${resource.volume?.volume} (${resource.volume?.volumeDecibels}dB)) (silence remaining: ${resource.silenceRemaining}) (silence padding frames: ${resource.silencePaddingFrames}) (metadata: ${resource.metadata})`,
);
this.createAndReturnOrGetAudioPlayer().play(resource);
this.audioResource = resource;

const isPlayable = this.audioPlayer?.checkPlayable();
if (isPlayable) {
return;
}
this.logger.warn(
`Current resource is is not playable. This means playback will get stuck. Please report this issue.`,
); // <--- this is where the bot goes into. It seems that the track is never playable
}
playResource(resource: AudioResource<unknown>) {
this.logger.debug(
`Playing audio resource with volume ${resource.volume?.volume} (${resource.playbackDuration}) (readable: ${resource.readable}) (volume: ${resource.volume?.volume} (${resource.volume?.volumeDecibels}dB)) (silence remaining: ${resource.silenceRemaining}) (silence padding frames: ${resource.silencePaddingFrames}) (metadata: ${resource.metadata})`,
);
this.createAndReturnOrGetAudioPlayer().play(resource);
this.audioResource = resource;

const isPlayable = this.audioPlayer?.checkPlayable();
if (isPlayable) {
return;
}
this.logger.warn(
`Current resource is is not playable. This means playback will get stuck. Please report this issue.`,
); // <--- this is where the bot goes into. It seems that the track is never playable
}
@OnEvent('internal.audio.track.announce')
handleOnNewTrack(track: Track) {
const resource = createAudioResource( // <--- builds the stream URL. Seems to build the correct one. Tried with OPUS and AAC
track.getStreamUrl(this.jellyfinStreamBuilder),
{
inlineVolume: true,
},
);
this.playResource(resource); // <-- calls the above function
}
@OnEvent('internal.audio.track.announce')
handleOnNewTrack(track: Track) {
const resource = createAudioResource( // <--- builds the stream URL. Seems to build the correct one. Tried with OPUS and AAC
track.getStreamUrl(this.jellyfinStreamBuilder),
{
inlineVolume: true,
},
);
this.playResource(resource); // <-- calls the above function
}
All relevant code in discord.voice.service.ts Log: https://pastebin.com/ZGyrYzmQ I already added tons of debugging branches & log statements to troubleshoot. Do you have suggestions for the next steps? How can I troubleshoot resources that can't be played? Also, the docs don't go into much detail why resources aren't "playable". I read the following pages and could not find further steps / ideas: https://discordjs.guide/voice/audio-resources.html#cheat-sheet, https://discord.js.org/docs/packages/voice/0.13.0/AudioPlayer:Class#checkPlayable Node: v20.13.1
[email protected] C:\XXXXXX\jellyfin-discord-music-bot
+-- @discord-nestjs/[email protected]
| `-- [email protected] deduped
+-- @discord-nestjs/[email protected]
| `-- [email protected] deduped
[email protected] C:\XXXXXX\jellyfin-discord-music-bot
+-- @discord-nestjs/[email protected]
| `-- [email protected] deduped
+-- @discord-nestjs/[email protected]
| `-- [email protected] deduped
Crosspost from #djs-questions , wrong channel. Sorry.
1 Reply
d.js toolkit
d.js toolkit•2d ago
- What are your intents? GuildVoiceStates is required to receive voice data! - Show what dependencies you are using -- generateDependencyReport() is exported from @discordjs/voice. - Try looking at common examples: https://github.com/discordjs/voice-examples. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Want results from more Discord servers?
Add your server