bundle.discord.cogs.music.player

Guild voice playback – timing, pause/resume.

Attributes

log

Exceptions

TrackProducedNoAudio

The stream ended before FFmpeg delivered a single frame (unreachable or rejected URL).

Classes

GuildPlayer

Owns voice playback and timing for a single guild.

Module Contents

bundle.discord.cogs.music.player.log
exception bundle.discord.cogs.music.player.TrackProducedNoAudio

Bases: RuntimeError

The stream ended before FFmpeg delivered a single frame (unreachable or rejected URL).

class bundle.discord.cogs.music.player.GuildPlayer(on_track_end: collections.abc.Callable[[int, Exception | None], collections.abc.Coroutine[Any, Any, None]])

Owns voice playback and timing for a single guild.

play_started_at: float = 0.0
pause_offset: float = 0.0
paused_at: float | None = None
consecutive_failures: int = 0
elapsed_secs() → int
async play(vc: discord.VoiceClient, track: bundle.youtube.track.YoutubeTrackData, guild_id: int) → bool

Start FFmpeg playback. Returns False if no stream URL available.

Streams the audio-only track: a voice channel needs nothing else, and the best video stream can be gigabytes. The source is built in a worker thread because it blocks until its jitter buffer has pre-filled.

pause(vc: discord.VoiceClient) → bool

Pause playback. Returns True if state changed.

resume(vc: discord.VoiceClient) → bool

Resume playback. Returns True if state changed.

stop(vc: discord.VoiceClient) → None

Stop current source, suppress the after callback.