Discord Player

BaseExtractor

No description provided

BaseExtractor

new BaseExtractor(context, options);
ParameterTypeOptionalDescription
contextExtractorExecutionContextContext that instantiated this extractor
optionsTInitialization 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 | PlaylistThe 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
messagestringThe debug message

public emit(event, args): boolean

Dispatch an event to the player

ParameterTypeOptionalDescription
eventKThe 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
querystringThe query to handle
contextExtractorSearchContextN/A

public handlePostStream(stream, next): void

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

ParameterTypeOptionalDescription
streamReadableThe incoming stream
nextNextFunctionThe next function

public reconfigure(options): Promise<void>

Reconfigures this extractor

ParameterTypeOptionalDescription
optionsTThe 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
querystringThe query to validate
typenull | SearchQueryTypeN/A