Discord Player

@discord-player/plugin-host

Entry point @discord-player/plugin-host in @discord-player/plugin-host (TypeScript API).

You are reading the v8 docsDev
Entry pointTypeScript@discord-player/plugin-host

Classes

BaseExtractorMinimal v7 lifecycle and source API, adapted to the source operation registry.
DiscordPlayerErrorBase error carrying a stable Discord Player error code.
ExtractorExecutionContextSmall legacy ownership adapter; all execution goes through player.plugins.
IllegalHookInvocationErrorError thrown when a guild-scoped hook cannot resolve a Player or guild queue.
LrcLibLRCLIB API client with serialized requests and bounded retries.
PlaylistA playlist and its tracks, independent of any Discord client library.
PluginErrorFailure attributed to a source registration and lifecycle stage or operation.
PluginRegistryContext-owned capability registry. Removal aborts and drains calls before teardown.
SafeEventEmitterTyped EventEmitter with a fallback error listener so unobserved errors do not crash the process.
SearchResultFamiliar search result wrapper used by Player-level playback.
SerializationErrorError thrown when a serialization input cannot be encoded or decoded.
SourcePluginHostSource runtime and the published Remedia transport sharing one set of handlers.
SourcePluginRuntimeShared source execution and compatibility facade, independent of audio and Discord clients.
SourceUnavailableErrorError thrown when a Track has no source plugin able to produce a Remedia source.
TrackA Discord-library-agnostic track model. Source resolution belongs to a source plugin.

Interfaces

ExecuteOptionsOptional dispatch targeting and cancellation.
ExtractorExecutionResultResult returned from compatibility bridge requests.
ExtractorSearchContextSearch context passed to legacy handle methods.
HandlerOptionsHandler ordering metadata.
LegacyPlayerContextSource-related Player surface shared by actual Players and standalone hosts.
LegacyTimeDataDuration fields consumed by legacy raw-stream extractors.
LrcGetParamsParameters accepted by LRCLIB's exact lookup endpoints.
LrcSearchParamsSearch parameters supported by the LRCLIB API.
LrcSearchResultLyrics record returned by LRCLIB search.
LyricsLineOne normalized synchronized lyric line.
LyricsRequestLookup input shared by local plugins and HTTP metadata transport.
LyricsResultProvider-neutral lyrics record; either representation may be absent.
MediaAccessPolicyAccess limits for remote media materialization. Providers execute trusted code; this is not a plugin sandbox.
OperationDeclaration merged operation contract.
OperationContextPer-invocation cancellation supplied to all handlers.
OperationMapExtensible source operation contracts. Augmented operations also need host definitions.
PlaylistDataMetadata used to construct a Playlist.
PlaylistJSONJSON-compatible Playlist representation.
PluginContextSource setup context shared by embedded and standalone execution.
PluginDefinitionSource declaration reusable across Player instances.
PluginRegistrationRegistration descriptor produced by a factory.
PortableLyricsRequestLyrics metadata request; persistence intentionally excludes runtime source-state hints.
PortableSourceQueryPortable search input, normalized before crossing the metadata boundary.
PortableSourceResultHTTP metadata response payload inside Remedia's handled/result envelope.
ProviderMapDeclaration-merged singleton services supplied only by modern plugins.
RemotePluginHostOptionsExisting standalone HTTP deployment. Authentication stays outside Track metadata.
SearchOptionsSource search and compatibility options.
SearchResultDataResolved Tracks and optional source playlist metadata returned by search.
SerializableStructural contract implemented by models that can produce a persistence payload.
SourceBridgeRequestFallback request excluding the original provider.
SourceMatchMatch result carries identity so metadata resolves through the same provider.
SourcePluginHostOptionsStandalone source host configuration.
SourcePluginRuntimeOptionsStandalone source configuration; no playback services are created.
SourceQuerySearch request independent of Discord client libraries.
SourceRelatedRequestRelated-media request with optional local legacy history.
SourceRuntimeEventsEvents supported by the source compatibility context.
SourceStreamTransformEncoded local stream transformation payload.
SourceTrackRequestSource request for one Track.
StreamResolutionOptionsPlayback resolution configuration selected after the Remedia session is connected.
SynchronousOperationMapDeclaration merged names restricted to synchronous callbacks.
TrackDataPublic metadata and optional portable source identity.
TrackJSONJSON-compatible representation of a Track.

Functions

cloneJSONValueValidate and clone an unknown value into JSON-safe data. Only primitives, dense arrays, and plain objects with data properties are accepted.
createSourcePluginHostCreate an independent source host; no HTTP server is started.
decodeDecode Base64 JSON without validating its entity shape. Decoded values must still pass through deserialize() before reconstruction.
definePluginDefine a reusable source plugin.
deserializeReconstruct a Track from a versioned Track payload.
deserializeSourceResultReconstruct source-host metadata in a consumer process without restoring private extractor objects. The normal Track retains the transient hint without requiring a second representation.
encodeEncode a versioned serialized entity as Base64 JSON.
normalizeLyricsNormalize and validate a lyrics record once, including sorted synchronized timestamps.
parseLyricsParse LRC once, including multiple timestamps and decimal-second fractions.
searchLyricsResolve lyrics through the same operation registry as source metadata.
serializeSerialize any model that follows the structural Serializable contract. The returned value is checked at runtime so custom implementations cannot emit non-JSON data.
serializeSourceTrackEncode a queued Track for a host operation, retaining its transient state hint.

Type aliases

DiscordPlayerErrorCodeError code union for Discord Player errors.
DispatchPolicyOperation dispatch behavior.
EncodableCompatibility alias for the supported serialized entity union.
EventMapEvent map whose values are listener argument tuples.
ExtractorConstructorClass constructors only: instances and modern plugin descriptors are not accepted.
ExtractorInfoLegacy extractor result.
ExtractorResolvableLegacy identifier or owned instance.
ExtractorStreamableLegacy encoded source; format hints cannot restore the obsolete audio stack.
JSONPrimitiveJSON scalar value accepted by Discord Player persistence payloads.
JSONValueDeep JSON-compatible value accepted by the serialization contract.
LrcGetResultLyrics record returned by the LRCLIB exact lookup endpoints.
MediaResourceMedia accepted by the public player orchestration API. Strings are dispatched to source plugins.
MetadataRequestDirect HTTP metadata request, also suitable for future generic forwarding.
NextFunctionLegacy post-stream callback.
OperationHandlerA handler may decline only by returning undefined.
OperationInputTyped input selected by operation name.
OperationNameNames available to source plugins.
OperationOutputTyped handler result selected by operation name.
OperationResultDispatch result selected by the declared policy.
PluginFactoryFactory requires options only when the options type has required fields.
PortableSourceTrackVersioned metadata plus an optional, expiring host-owned process-state hint. Use serializeSourceTrack() for operation requests; serialize() deliberately omits the hint.
ProviderReferenceSerializable provider identity; never put credentials or live objects in this payload.
RawTrackDataLegacy raw construction fields; live engines and callbacks remain process-local.
SearchQueryTypeLegacy query hint, including provider-defined string values.
SerializedEntityA versioned, discriminated serialized entity.
SerializedEntityUnionVersioned persistence entities supported by Discord Player.
SerializedPlaylistVersion 1 persistence representation of a Playlist.
SerializedPlaylistDataPublic Playlist fields stored by the versioned persistence format.
SerializedTrackVersion 1 persistence representation of a Track.
SerializedTrackDataPublic Track fields stored by the versioned persistence format.
SourceStreamSupported local source results. Readables and byte buffers require embedded Remedia.
TrackRequesterRequester identifier or a structural requester object.
TrackSourceName or identifier for a Track's source integration.
WithMetadataLegacy metadata refinement for custom extractor helpers.

Variables

DiscordPlayerErrorCodePublic error codes for Discord Player's application-level failures.
lrclibPluginOptional LRCLIB provider. No provider is installed by constructing a Player.
QueryTypeLegacy symbolic query hints. Uppercase underscore keys map to their v7 camel-case string values. Source-specific routing stays in plugins; this object performs no network or URL classification.
SERIALIZATION_SCHEMA_VERSIONCurrent Discord Player serialization schema version, independent of package versions.
SerializedTypeEntity discriminator values used in versioned persistence payloads.
SOURCE_PLUGIN_IDStable aggregate protocol registration identifier.
UtilSmall metadata helpers; obsolete voice and transcoding helpers are intentionally unavailable.

On this page