Discord Player

BaseExtractor

No description provided

BaseExtractor

new BaseExtractor(context, options);
ParameterTypeOptionalDescription
contextExtractorExecutionContext❌Context that instantiated this extractor
optionsT❌Initialization options for this extractor

Properties

public context: any

Context that instantiated this extractor

public options: any

Initialization options for this extractor

public priority: any

Priority of this extractor. Higher value means higher priority (will be executed first).

public protocols: any

A list of query protocols that this extractor supports.

public static identifier: any

Identifier for this extractor

public identifier: any

Identifier of this extractor

public supportsDemux: any

A flag to indicate Demuxable stream support for opus/ogg/opus/webm/opus formats.

Methods

public activate(): Promise<void>

This method will be executed when this extractor is activated

public bridge(track, sourceExtractor): Promise<null | ExtractorStreamable>

Handle stream extraction for another extractor

ParameterTypeOptionalDescription
trackTrack<unknown>❌The track to bridge
sourceExtractornull | BaseExtractor<object>❌The source extractor

public createBridgeQuery(track): string

Handle bridge query creation

ParameterTypeOptionalDescription
trackTrack<unknown>❌The track to build query for

public createResponse(playlist?, tracks): ExtractorInfo

Create extractor response

ParameterTypeOptionalDescription
playlistnull | Playlist✅The playlist
tracksArray<Track<unknown>>❌The track array

public deactivate(): Promise<void>

This method will be executed when this extractor is deactivated

public debug(message): boolean

Write debug message

ParameterTypeOptionalDescription
messagestring❌The debug message

public emit(event, args): boolean

Dispatch an event to the player

ParameterTypeOptionalDescription
eventK❌The event to dispatch
argsParameters<PlayerEvents[K]>❌The data to dispatch

public getRelatedTracks(track, history): Promise<ExtractorInfo>

Get related tracks for the given track

ParameterTypeOptionalDescription
trackTrack<unknown>❌The track source
historyGuildQueueHistory<unknown>❌N/A

public handle(query, context): Promise<ExtractorInfo>

Handle the given query

ParameterTypeOptionalDescription
querystring❌The query to handle
contextExtractorSearchContext❌N/A

public handlePostStream(stream, next): void

A stream middleware to handle streams before passing it to the player

ParameterTypeOptionalDescription
streamReadable❌The incoming stream
nextNextFunction❌The next function

public reconfigure(options): Promise<void>

Reconfigures this extractor

ParameterTypeOptionalDescription
optionsT❌The new options to apply

public stream(info): Promise<ExtractorStreamable>

Stream the given track

ParameterTypeOptionalDescription
infoTrack<unknown>❌The track to stream

public validate(query, type?): Promise<boolean>

Validate incoming query

ParameterTypeOptionalDescription
querystring❌The query to validate
typenull | SearchQueryType✅N/A