/** * The different event types that can be received by the client. * * @see https://github.com/sedmelluq/lavaplayer/blob/master/main/src/main/java/com/sedmelluq/discord/lavaplayer/track/AudioTrackEndReason.java */ import type { TrackHash } from "../../rest/track"; import type { PlayerMessage } from "./message"; export declare type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent"; /** * The different end reasons. */ export declare enum TrackEndReason { /** * This means the track itself emitted a terminator. This is usually caused by the track reaching the end, * however it will also be used when it ends due to an exception. */ Finished = "FINISHED", /** * This means that the track failed to start, throwing an exception before providing any audio. */ LoadFailed = "LOAD_FAILED", /** * The track was stopped due to the player being stopped by the "stop" operation. */ Stopped = "STOPPED", /** * The track stopped playing because a new track started playing. Note that with this reason, the old track will still * play until either it's buffer runs out or audio from the new track is available. */ Replaced = "REPLACED", /** * The track was stopped because the cleanup threshold for the audio player has reached. This triggers when the amount * of time passed since the last frame fetch has reached the threshold specified in the player manager. * This may also indicate either a leaked audio player which has discarded, but not stopped. */ Cleanup = "CLEANUP" } /** * */ export declare const mayStartNext: Record; declare type Event = PlayerMessage<"event", { type: T; } & D>; /** * An equalizer band, contains the band index and it's gain. */ export interface EqualizerBand { gain: number; band: number; } /** * Event that is fired when a track starts playing. */ export declare type TrackStartEvent = Event<"TrackStartEvent", TrackStartEventData>; export interface TrackStartEventData { /** * The track that had started. */ track: TrackHash; } /** * */ export declare type TrackEndEvent = Event<"TrackEndEvent", TrackEndEventData>; export interface TrackEndEventData { /** * Audio track that ended. */ track: string | null; /** * The reason why the track stopped playing. */ reason: TrackEndReason; } /** * Event that is fired when a track was started, but no audio frames from it have arrived in a long time, * specified by the threshold set. */ export declare type TrackStuckEvent = Event<"TrackStuckEvent", TrackStuckEventData>; export interface TrackStuckEventData { /** * Audio track where the exception occurred. */ track: string | null; /** * The wait threshold that was exceeded for this event to trigger. */ thresholdMs: number; } /** * Event that is fired when an exception occurs in an audio track that causes it to halt or not start. */ export declare type TrackExceptionEvent = Event<"TrackExceptionEvent", TrackExceptionEventData>; export interface TrackExceptionEventData { /** * Audio track where the exception occurred. */ track: string | null; /** * The exception. */ error: string; } /** * Event that is fired when an audio websocket (to Discord) is closed. */ export declare type WebSocketClosedEvent = Event<"WebSocketClosedEvent", WebSocketClosedEventData>; export interface WebSocketClosedEventData { /** * The close code given * * @see https://discordapp.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes */ code: number; /** * The reason for closing the websocket. */ reason: string; /** * Whether the websocket connection was closed by a remote source. */ byRemote: boolean; } export declare type PlayerUpdate = PlayerMessage<"playerUpdate", PlayerUpdateData>; export interface PlayerUpdateData { /** * The state of the player. */ state: PlayerUpdateState; } export interface PlayerUpdateState { /** * Unix timestamp (in milliseconds). */ time: number; /** * Current track position (in milliseconds). Omitted when not playing anything/ */ position?: number; /** * Whether the player is connected to a voice channel. */ connected: boolean; /** * The number of milliseconds between the voice connection heartbeat and Discord acknowledging it. Could be `-1` if not connected. */ ping: number; } export {}; //# sourceMappingURL=player.d.ts.map