Interface Client
- All Known Implementing Classes:
Android,AndroidLite,AndroidMusic,AndroidTestsuite,Ios,MediaConnect,Music,MusicClient,NonMusicClient,StreamingNonMusicClient,TvHtml5Embedded,Web,WebEmbedded
public interface Client
The interface for a Client.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull com.sedmelluq.discord.lavaplayer.track.AudioTrackbuildAudioTrack(@NotNull YoutubeAudioSourceManager source, @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser json, @NotNull String title, @NotNull String author, long duration, @NotNull String videoId, boolean isStream) Builds an audio track with the given parameters.booleancanHandleRequest(@NotNull String identifier) Returns a boolean determining whether this client can be used to handle requests for the given identifier.default @Nullable com.sedmelluq.discord.lavaplayer.track.AudioTrackfindSelectedTrack(@NotNull List<com.sedmelluq.discord.lavaplayer.track.AudioTrack> tracks, @Nullable String selectedVideoId) @NotNull Stringdefault @NotNull ClientOptionsdefault @NotNull Client.PlayabilityStatusgetPlayabilityStatus(@NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser playabilityStatus, boolean throwOnNotOk) @NotNull Stringdefault @Nullable StringgetUnplayableReason(@NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser statusBlock) @Nullable TrackFormatsloadFormats(@NotNull YoutubeAudioSourceManager source, @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull String videoId) Loads streaming formats for a video.@Nullable com.sedmelluq.discord.lavaplayer.track.AudioItemloadMix(@NotNull YoutubeAudioSourceManager source, @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull String mixId, @Nullable String selectedVideoId) Loads a mix playlist.@Nullable com.sedmelluq.discord.lavaplayer.track.AudioItemloadPlaylist(@NotNull YoutubeAudioSourceManager source, @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull String playlistId, @Nullable String selectedVideoId) Loads a playlist.@Nullable com.sedmelluq.discord.lavaplayer.track.AudioItemloadSearch(@NotNull YoutubeAudioSourceManager source, @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull String searchQuery) Loads search results for a query.@Nullable com.sedmelluq.discord.lavaplayer.track.AudioItemloadSearchMusic(@NotNull YoutubeAudioSourceManager source, @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull String searchQuery) Loads search results for a query.@Nullable com.sedmelluq.discord.lavaplayer.track.AudioItemloadVideo(@NotNull YoutubeAudioSourceManager source, @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull String videoId) Loads a single video.voidsetPlaylistPageCount(int count) default booleandefault @NotNull URItransformPlaybackUri(@NotNull URI originalUri, @NotNull URI resolvedPlaybackUri) Transforms a given playback URL as necessary.
-
Field Details
-
WATCH_URL
- See Also:
-
API_BASE_URL
- See Also:
-
PLAYER_URL
- See Also:
-
SEARCH_URL
- See Also:
-
NEXT_URL
- See Also:
-
BROWSE_URL
- See Also:
-
MUSIC_API_BASE_URL
- See Also:
-
MUSIC_SEARCH_URL
- See Also:
-
SEARCH_PARAMS
- See Also:
-
MUSIC_SEARCH_PARAMS
- See Also:
-
-
Method Details
-
getPlayabilityStatus
@NotNull default @NotNull Client.PlayabilityStatus getPlayabilityStatus(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser playabilityStatus, boolean throwOnNotOk) throws CannotBeLoaded - Throws:
CannotBeLoaded
-
getUnplayableReason
@Nullable default @Nullable String getUnplayableReason(@NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser statusBlock) -
findSelectedTrack
-
transformPlaybackUri
@NotNull default @NotNull URI transformPlaybackUri(@NotNull @NotNull URI originalUri, @NotNull @NotNull URI resolvedPlaybackUri) Transforms a given playback URL as necessary. For example, you can add query parameters or resolve any challenge parameters that might be needed.- Parameters:
originalUri- The original stream URI. This will be completely unmodified, and is provided as it has been received from YouTube.resolvedPlaybackUri- The playback URI. This will have already been transformed by the SignatureCipherManager.- Returns:
- The new playback URI.
-
buildAudioTrack
@NotNull default @NotNull com.sedmelluq.discord.lavaplayer.track.AudioTrack buildAudioTrack(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.JsonBrowser json, @NotNull @NotNull String title, @NotNull @NotNull String author, long duration, @NotNull @NotNull String videoId, boolean isStream) Builds an audio track with the given parameters. Hint: You can useYoutubeAudioSourceManager.buildAudioTrack(AudioTrackInfo)to build a track with the given AudioTrackInfo.- Parameters:
source- The source responsible for this track.json- The video JSON. This can be used to extract extra metadata.title- The title of the video.author- The video uploader.duration- The duration of the video.videoId- The video identifier.isStream- Whether this video is a livestream.- Returns:
- The built audio track.
-
getIdentifier
- Returns:
- The unique identifier for this client.
-
getPlayerParams
-
getOptions
-
canHandleRequest
Returns a boolean determining whether this client can be used to handle requests for the given identifier.- Parameters:
identifier- The resource identifier. Could be an arbitrary string or a URL.- Returns:
- True, if this client can handle the request.
-
supportsFormatLoading
default boolean supportsFormatLoading()- Returns:
- True, if this client can be used for loading playback URLs.
-
setPlaylistPageCount
void setPlaylistPageCount(int count) -
loadFormats
@Nullable @Nullable TrackFormats loadFormats(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String videoId) throws CannotBeLoaded, IOException Loads streaming formats for a video.- Parameters:
source- The source manager responsible for this client.httpInterface- The interface to use for requests.videoId- The ID of the video to load formats for.- Throws:
CannotBeLoaded- If a video doesn't exist etc.IOException
-
loadVideo
@Nullable @Nullable com.sedmelluq.discord.lavaplayer.track.AudioItem loadVideo(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String videoId) throws CannotBeLoaded, IOException Loads a single video.- Parameters:
source- The source manager responsible for this client.httpInterface- The interface to use for requests.videoId- The ID of the video to load.- Returns:
- An AudioItem.
- Throws:
CannotBeLoaded- If a video doesn't exist etc.IOException
-
loadSearch
@Nullable @Nullable com.sedmelluq.discord.lavaplayer.track.AudioItem loadSearch(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String searchQuery) throws CannotBeLoaded, IOException Loads search results for a query.- Parameters:
source- The source manager responsible for this client.httpInterface- The interface to use for requests.searchQuery- The search query.- Returns:
- An AudioItem.
- Throws:
CannotBeLoaded- If a video doesn't exist etc.IOException
-
loadSearchMusic
@Nullable @Nullable com.sedmelluq.discord.lavaplayer.track.AudioItem loadSearchMusic(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String searchQuery) throws CannotBeLoaded, IOException Loads search results for a query.- Parameters:
source- The source manager responsible for this client.httpInterface- The interface to use for requests.searchQuery- The search query.- Returns:
- An AudioItem.
- Throws:
CannotBeLoaded- If a video doesn't exist etc.IOException
-
loadMix
@Nullable @Nullable com.sedmelluq.discord.lavaplayer.track.AudioItem loadMix(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String mixId, @Nullable @Nullable String selectedVideoId) throws CannotBeLoaded, IOException Loads a mix playlist.- Parameters:
source- The source manager responsible for this client.httpInterface- The interface to use for requests.mixId- The ID of the mix.- Returns:
- An AudioItem.
- Throws:
CannotBeLoaded- If a video doesn't exist etc.IOException
-
loadPlaylist
@Nullable @Nullable com.sedmelluq.discord.lavaplayer.track.AudioItem loadPlaylist(@NotNull @NotNull YoutubeAudioSourceManager source, @NotNull @NotNull com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface httpInterface, @NotNull @NotNull String playlistId, @Nullable @Nullable String selectedVideoId) throws CannotBeLoaded, IOException Loads a playlist.- Parameters:
source- The source manager responsible for this client.httpInterface- The interface to use for requests.playlistId- The ID of the playlist.- Returns:
- An AudioItem.
- Throws:
CannotBeLoaded- If a video doesn't exist etc.IOException
-