Supported Stream Sources
Learn about the supported stream sources in discord-player
By default, discord-player does not support anything (including search operation and streaming). Luckily, discord-player supports the following sources with the help of @discord-player/extractor which comes pre-installed with discord-player:
- Local file (You must set the search engine to
QueryType.FILE
in order to play local files, backed byattachment extractor
) - Raw attachments (backed by
attachment extractor
) - Spotify (backed by
spotify extractor
) - Apple Music (backed by
appleMusic extractor
) - Vimeo (backed by
vimeo extractor
) - Reverbnation (backed by
reverbnation extractor
) - SoundCloud (backed by
soundcloud extractor
)
If you dont want to stream from certain extractors, you can block them by passing blockStreamFrom: [id, id, ...]
to player instantiation options.
Disabling streaming from specific extractor completely would be as easy as:
Likewise, You can also force a specific extractor to resolve your search query. This is useful in some cases where you don't want to use other sources.
You can do so by using ext:<EXTRACTOR_IDENTIFIER>
in searchEngine
value. Example:
Overriding bridged stream
Extractors such as AppleMusicExtractor, SpotifyExtractor cannot stream from their original source so they internally use alternative methods to resolve streams.
In order to bypass this behavior, you can override createStream
function of the extractor like so:
Using protocols
Discord Player supports protocol based search queries which can target specific extractor. The query format for this type of action is protocolName:queryValue
.
For example, if you want to make soundcloud search, you can use scsearch:songName
as your search query. Discord Player executes first extractor that supports this query.
If none of the extractor support this protocol, discord-player resolves your query via default query resolving algorithm.
List of protocols supported by @discord-player/extractor
s
Extractor | Protocols |
---|---|
SpotifyExtractor | spsearch , spotify |
SoundcloudExtractor | scsearch , soundcloud |
AppleMusicExtractor | amsearch , applemusic |
Adding more sources
Discord Player provides an Extractor API that enables you to use your custom stream extractor with it. Some packages have been made by the community to add new features using this API.