Interface: Application
Properties
networkRequest
• networkRequest: (input
: RequestInfo
| URL
, init?
: RequestInit
) => Promise
<Response
>
Type declaration
▸ (input
, init?
): Promise
<Response
>
Make a networkRequest from parent AudioGata frame rather from plugin frame.
Parameters
Name | Type |
---|---|
input | RequestInfo | URL |
init? | RequestInit |
Returns
Promise
<Response
>
Methods
addPlaylists
▸ addPlaylists(playlists
): Promise
<void
>
Adds or updates playlists. Playlists with the same id are updated.
Parameters
Name | Type |
---|---|
playlists | Playlist [] |
Returns
Promise
<void
>
addTracksToPlaylist
▸ addTracksToPlaylist(playlistId
, tracks
): Promise
<void
>
Adds tracks to a playlist
Parameters
Name | Type | Description |
---|---|---|
playlistId | string | id of playlist |
tracks | Track [] | Tracks being added to playlist |
Returns
Promise
<void
>
createNotification
▸ createNotification(notification
): Promise
<void
>
Show user a notification on the bottom left of the screen
Parameters
Name | Type |
---|---|
notification | NotificationMessage |
Returns
Promise
<void
>
endTrack
▸ endTrack(): Promise
<void
>
When plugin is acting as an embedded player, used to signal that the track has end.
Returns
Promise
<void
>
getCorsProxy
▸ getCorsProxy(): Promise
<undefined
| string
>
Get cors proxy configured in settings.
Returns
Promise
<undefined
| string
>
getLocale
▸ getLocale(): Promise
<string
>
Get locale configured in settings.
Returns
Promise
<string
>
getNowPlayingTracks
▸ getNowPlayingTracks(): Promise
<Track
[]>
Get the user's Now Plyaing Queue track list;
Returns
Promise
<Track
[]>
getPlaylists
▸ getPlaylists(): Promise
<Playlist
[]>
Get the user's current playlists including tracks.
Returns
Promise
<Playlist
[]>
getPlaylistsInfo
▸ getPlaylistsInfo(): Promise
<PlaylistInfo
[]>
Get the users's current playlists metadata without tracks.
Returns
Promise
<PlaylistInfo
[]>
getPluginId
▸ getPluginId(): Promise
<string
>
Get the current plugin's id.
Returns
Promise
<string
>
getPlugins
▸ getPlugins(): Promise
<PluginInfo
[]>
Get user's currently installed plugins.
Returns
Promise
<PluginInfo
[]>
getTheme
▸ getTheme(): Promise
<Theme
>
Returns the user's current theme
Returns
Promise
<Theme
>
installPlugins
▸ installPlugins(plugins
): Promise
<void
>
Open user dialog for user to optionally install plugins
Parameters
Name | Type |
---|---|
plugins | PluginInfo [] |
Returns
Promise
<void
>
isNetworkRequestCorsDisabled
▸ isNetworkRequestCorsDisabled(): Promise
<boolean
>
Used to determine whether requests from networkRequest are restricted by CORs.
Returns
Promise
<boolean
>
onCanParseUrl
▸ Optional
onCanParseUrl(url
, type
): Promise
<boolean
>
Callback method that checks to see if url can be parsed by plugin so that onLookupPlaylistUrl returns results
Parameters
Name | Type |
---|---|
url | string |
type | ParseUrlType |
Returns
Promise
<boolean
>
onChangeTheme
▸ onChangeTheme(theme
): Promise
<void
>
Callback method that is called after a users changes theme
Parameters
Name | Type |
---|---|
theme | Theme |
Returns
Promise
<void
>
onDeepLinkMessage
▸ Optional
onDeepLinkMessage(message
): Promise
<void
>
Callback method to return deep link messages in mobile
Parameters
Name | Type |
---|---|
message | string |
Returns
Promise
<void
>
onGetAlbumTracks
▸ Optional
onGetAlbumTracks(request
): Promise
<AlbumTracksResult
>
Callback method that gets an albums's tracks. Used on /plugins/:pluginId/albums/:apiId
Parameters
Name | Type |
---|---|
request | AlbumTrackRequest |
Returns
Promise
<AlbumTracksResult
>
onGetArtistAlbums
▸ Optional
onGetArtistAlbums(request
): Promise
<ArtistAlbumsResult
>
Callback method that gets an artists's albums. Used on /plugins/:pluginId/artists/:apiId
Parameters
Name | Type |
---|---|
request | ArtistAlbumRequest |
Returns
Promise
<ArtistAlbumsResult
>
onGetLyrics
▸ onGetLyrics(request
): Promise
<GetLyricsResponse
>
Callback method to get lyrics based on a track's name and artist name
Parameters
Name | Type |
---|---|
request | GetLyricsRequest |
Returns
Promise
<GetLyricsResponse
>
onGetPlaylistTracks
▸ Optional
onGetPlaylistTracks(request
): Promise
<PlaylistTracksResult
>
Callback method that gets a playlist's tracks. Used on /plugins/:pluginId/playlists/:apiId
Parameters
Name | Type |
---|---|
request | PlaylistTrackRequest |
Returns
Promise
<PlaylistTracksResult
>
onGetSearchSuggestions
▸ onGetSearchSuggestions(request
): Promise
<string
[]>
Callback method that returns search suggestions when a query is typed in the search bar
Parameters
Name | Type |
---|---|
request | GetSearchSuggestionsRequest |
Returns
Promise
<string
[]>
onGetTopItems
▸ Optional
onGetTopItems(): Promise
<SearchAllResult
>
Callback method to return items to display on Home page.
Returns
Promise
<SearchAllResult
>
onGetTrack
▸ Optional
onGetTrack(request
): Promise
<Track
>
Callback method to get track information. Used on /track/:id
Parameters
Name | Type |
---|---|
request | GetTrackRequest |
Returns
Promise
<Track
>
onGetTrackUrl
▸ Optional
onGetTrackUrl(request
): Promise
<string
>
Callback method to get track url. Must be set to play track if onPlay is not set.
Parameters
Name | Type |
---|---|
request | GetTrackUrlRequest |
Returns
Promise
<string
>
Url to play
onGetUserPlaylists
▸ Optional
onGetUserPlaylists(request
): Promise
<SearchPlaylistResult
>
Callback method that gets user playlists. Used on /plugins/:pluginId/playlists
Parameters
Name | Type |
---|---|
request | UserPlaylistRequest |
Returns
Promise
<SearchPlaylistResult
>
onLookupPlaylistUrl
▸ Optional
onLookupPlaylistUrl(url
): Promise
<Playlist
>
Callback method that takes a url and returns a playlist.
Used on the /playlists
page.
Parameters
Name | Type |
---|---|
url | string |
Returns
Promise
<Playlist
>
onLookupTrack
▸ onLookupTrack(request
): Promise
<Track
>
Callback method to lookup up track based on track information. It is used to convert tracks to use a different plugin.
Parameters
Name | Type |
---|---|
request | LookupTrackRequest |
Returns
Promise
<Track
>
onLookupTrackUrls
▸ Optional
onLookupTrackUrls(urls
): Promise
<Track
[]>
Callback method that takes urls and returns tracks.
Parameters
Name | Type |
---|---|
urls | string [] |
Returns
Promise
<Track
[]>
onNowPlayingTracksAdded
▸ Optional
onNowPlayingTracksAdded(tracks
): Promise
<void
>
Callback method to detect when new tracks got added to Now Playing queue
Parameters
Name | Type | Description |
---|---|---|
tracks | Track [] | Tracks that got added to queue |
Returns
Promise
<void
>
onNowPlayingTracksChanged
▸ Optional
onNowPlayingTracksChanged(tracks
): Promise
<void
>
Callback method to detect when tracks got changed in the Now Playing queue
Parameters
Name | Type | Description |
---|---|---|
tracks | Track [] | Tracks that were changed in the queue |
Returns
Promise
<void
>
onNowPlayingTracksRemoved
▸ Optional
onNowPlayingTracksRemoved(tracks
): Promise
<void
>
Callback method to detect when tracks got removed from Now Playing queue
Parameters
Name | Type | Description |
---|---|---|
tracks | Track [] | Tracks that got removed to queue |
Returns
Promise
<void
>
onNowPlayingTracksSet
▸ Optional
onNowPlayingTracksSet(tracks
): Promise
<void
>
Callback method to detect when there is a new tracklist in the Now Playing queue
Parameters
Name | Type | Description |
---|---|---|
tracks | Track [] | Current track list |
Returns
Promise
<void
>
onPause
▸ Optional
onPause(): Promise
<void
>
Callback method to pause embedded player
Returns
Promise
<void
>
onPlay
▸ Optional
onPlay(track
): Promise
<void
>
Callback method to play the track using an embedded player in the plugin.
Parameters
Name | Type | Description |
---|---|---|
track | PlayTrackRequest | The Track to play |
Returns
Promise
<void
>
onResume
▸ Optional
onResume(): Promise
<void
>
Callback method to resume embedded player
Returns
Promise
<void
>
onSearchAlbums
▸ Optional
onSearchAlbums(request
): Promise
<SearchAlbumResult
>
Callback method to return album search results on /search
Remarks
This method must be set for album pagination to work on the
/search
page
Parameters
Name | Type |
---|---|
request | SearchRequest |
Returns
Promise
<SearchAlbumResult
>
onSearchAll
▸ Optional
onSearchAll(request
): Promise
<SearchAllResult
>
Callback method to return search results on /search
Remarks
This method must be set for the plugin to show on the
/search
page
Parameters
Name | Type |
---|---|
request | SearchRequest |
Returns
Promise
<SearchAllResult
>
onSearchArtists
▸ Optional
onSearchArtists(request
): Promise
<SearchArtistResult
>
Callback method to return artist search results on /search
Remarks
This method must be set for artist pagination to work on the
/search
page
Parameters
Name | Type |
---|---|
request | SearchRequest |
Returns
Promise
<SearchArtistResult
>
onSearchPlaylists
▸ Optional
onSearchPlaylists(request
): Promise
<SearchPlaylistResult
>
Callback method to return playlist search results on /search
Remarks
This method must be set for playlist pagination to work on the
/search
page
Parameters
Name | Type |
---|---|
request | SearchRequest |
Returns
Promise
<SearchPlaylistResult
>
onSearchTracks
▸ Optional
onSearchTracks(request
): Promise
<SearchTrackResult
>
Callback method to return track search results on /search
Remarks
This method must be set for track pagination to work on the
/search
page
Parameters
Name | Type |
---|---|
request | SearchRequest |
Returns
Promise
<SearchTrackResult
>
onSeek
▸ Optional
onSeek(time
): Promise
<void
>
Callback method to seek time in the embedded player
Parameters
Name | Type | Description |
---|---|---|
time | number | Time in seconds |
Returns
Promise
<void
>
onSetPlaybackRate
▸ Optional
onSetPlaybackRate(rate
): Promise
<void
>
Callback method to set the playback rate of the embedded player
Parameters
Name | Type | Description |
---|---|---|
rate | number | Percent of rate normal play rate. min 0, max 200. |
Returns
Promise
<void
>
onSetVolume
▸ Optional
onSetVolume(volume
): Promise
<void
>
Callback method to set volume of embedded player
Parameters
Name | Type | Description |
---|---|---|
volume | number | Volume of player. 1 is 100% volume. 0.5 is 50%. min 0, max 1 |
Returns
Promise
<void
>
onUiMessage
▸ Optional
onUiMessage(message
): void
Callback method that receives parent.postMessage requests from UI frames.
Parameters
Name | Type |
---|---|
message | any |
Returns
void
postUiMessage
▸ postUiMessage(msg
): Promise
<void
>
Sends a message to ui frames like options
set in manifest.json
.
Parameters
Name | Type |
---|---|
msg | any |
Returns
Promise
<void
>
setNowPlayingTracks
▸ setNowPlayingTracks(tracks
): Promise
<void
>
Set the user's Now Playing Queue track list;
Parameters
Name | Type |
---|---|
tracks | Track [] |
Returns
Promise
<void
>
setTrackTime
▸ setTrackTime(currentTime
): Promise
<void
>
When plugin is acting as an embedded player, used to show user current track time.
Parameters
Name | Type |
---|---|
currentTime | number |
Returns
Promise
<void
>