BaseExtractor
Minimal v7 lifecycle and source API, adapted to the source operation registry.
class BaseExtractor<Options extends object = object>Minimal v7 lifecycle and source API, adapted to the source operation registry.
Constructors
constructor
constructor<Options extends object = object>(
context: ExtractorExecutionContext,
options: Options = ...,
)Create a compatibility instance; use player.extractors.register to own it.
Parameters
| Name | Type | Description |
|---|---|---|
| context | ExtractorExecutionContext | Owning compatibility context. |
| options | OptionsDefault: ... | Original extractor options. |
Properties
priority
priority: numberHigher priority wins before match confidence.
protocols
protocols: string[]Supported explicit query protocols.
context
context: ExtractorExecutionContextOwning legacy registration context.
options
options: OptionsOriginal local extractor configuration.
Accessors
identifierreadonly
readonly get identifier(): stringSubclass static identifier.
Returns
string
supportsDemuxreadonly
readonly get supportsDemux(): booleanObsolete demux support is unavailable.
Returns
boolean
Methods
resolveLyricsoptional
resolveLyrics(
input: string | Track<unknown>,
): Promise<LyricsResult | LyricsResult[] | null>Optional lyrics capability, adapted into the shared operation dispatcher.
Parameters
| Name | Type | Description |
|---|---|---|
| input | string | Track<unknown> | Track metadata or a raw lookup query. |
Returns
Promise<LyricsResult | LyricsResult[] | null>
Lyrics records, or null when no lyrics were found.
activate
deactivate
reconfigure
reconfigure(options: Options): Promise<void>Recreate the owned registration with new options.
Parameters
| Name | Type | Description |
|---|---|---|
| options | Options | Replacement options. |
Returns
Promise<void>
validate
validate(query: string, type?: string | null): Promise<boolean>Test whether this extractor accepts a query.
Parameters
| Name | Type | Description |
|---|---|---|
| query | string | Search text. |
| type? | string | null | Query hint. |
Returns
Promise<boolean>
handle
handle(query: string, context: ExtractorSearchContext): Promise<SearchResultData>Resolve metadata.
Parameters
| Name | Type | Description |
|---|---|---|
| query | string | Search text. |
| context | ExtractorSearchContext | Search hints. |
Returns
Promise<SearchResultData>
stream
stream(track: Track): Promise<ExtractorStreamable | undefined>Resolve media, or decline to enable bridging.
Parameters
| Name | Type | Description |
|---|---|---|
| track | Track | Track to stream. |
Returns
Promise<ExtractorStreamable | undefined>
getRelatedTracks
getRelatedTracks(track: Track, history?: unknown): Promise<SearchResultData>Resolve related metadata.
Parameters
| Name | Type | Description |
|---|---|---|
| track | Track | Seed track. |
| history? | unknown | Optional queue history; local execution only. |
Returns
Promise<SearchResultData>
bridge
bridge(
track: Track,
sourceExtractor: BaseExtractor<any> | null,
): Promise<ExtractorStreamable | null>Explicit fallback for another source.
Parameters
| Name | Type | Description |
|---|---|---|
| track | Track | Track needing a stream. |
| sourceExtractor | BaseExtractor<any> | null | Original extractor, if legacy. |
Returns
Promise<ExtractorStreamable | null>
handlePostStream
handlePostStream(stream: Readable, next: NextFunction): voidTransform an encoded local Readable. Raw codec overrides are unsupported.
Parameters
| Name | Type | Description |
|---|---|---|
| stream | Readable | Encoded input. |
| next | NextFunction | Completion callback. |
Returns
void
createBridgeQuery
createBridgeQuery(track: Track): stringBuild an anonymous bridge query.
Parameters
| Name | Type | Description |
|---|---|---|
| track | Track | Track metadata. |
Returns
string
createResponse
createResponse(
playlist: Playlist | null = null,
tracks: Track<unknown>[] = ...,
): SearchResultDataConstruct a metadata response.
Parameters
| Name | Type | Description |
|---|---|---|
| playlist | Playlist | nullDefault: null | Optional playlist. |
| tracks | Track<unknown>[]Default: ... | Ordered tracks, defaulting to playlist entries. |
Returns
SearchResultData
debug
debug(message: string): voidPublish a diagnostic.
Parameters
| Name | Type | Description |
|---|---|---|
| message | string | Diagnostic text. |
Returns
void
emit
emit<K extends keyof SourceRuntimeEvents>(
event: K,
...args: SourceRuntimeEvents[K],
): booleanForward supported Player events.
Parameters
| Name | Type | Description |
|---|---|---|
| event | K | Player event. |
| ...args | SourceRuntimeEvents[K] | Event arguments. |
Returns
boolean
Static properties
identifierstatic
static identifier: stringDefault identifier; subclasses should override.