capacitor-plugin-musickit
v0.0.81
Published
Requires iOS 16 or higher
Downloads
24
Readme
capacitor-plugin-musickit
Requires iOS 16 or higher
Install
npm install capacitor-plugin-musickit
npx cap sync
API
addListener('playbackStateDidChange', ...)
addListener('nowPlayingItemDidChange', ...)
addListener('authorizationStatusDidChange', ...)
addRating(...)
api(...)
authorize()
configure(...)
deleteRating(...)
echo(...)
getCatalogAlbums(...)
getCatalogArtists(...)
getCurrentIndex()
getCurrentPlaybackDuration()
getCurrentPlaybackTime()
getCurrentSong()
getLibraryAlbums(...)
getLibraryArtists(...)
getLibraryPlaylists(...)
getLibrarySongs(...)
getQueueSongs()
getRatings(...)
getRepeatMode()
getShuffleMode()
hasMusicSubscription()
isAuthorized()
nextPlay()
pause()
play(...)
previousPlay()
seekToTime(...)
setQueue(...)
setRepeatMode(...)
setShuffleMode(...)
setSong(...)
stop()
unauthorize()
- Interfaces
- Type Aliases
addListener('playbackStateDidChange', ...)
addListener(eventName: "playbackStateDidChange", listenerFunc: PlaybackStateDidChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
| Param | Type |
| ------------------ | ----------------------------------------------------------------------------------------- |
| eventName
| 'playbackStateDidChange' |
| listenerFunc
| PlaybackStateDidChangeListener |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addListener('nowPlayingItemDidChange', ...)
addListener(eventName: "nowPlayingItemDidChange", listenerFunc: NowPlayingItemDidChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------------- |
| eventName
| 'nowPlayingItemDidChange' |
| listenerFunc
| NowPlayingItemDidChangeListener |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addListener('authorizationStatusDidChange', ...)
addListener(eventName: "authorizationStatusDidChange", listenerFunc: AuthorizationStatusDidChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
| Param | Type |
| ------------------ | ----------------------------------------------------------------------------------------------------- |
| eventName
| 'authorizationStatusDidChange' |
| listenerFunc
| AuthorizationStatusDidChangeListener |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addRating(...)
addRating(options: AddRatingOptions) => Promise<void>
| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options
| AddRatingOptions |
api(...)
api<T>(options: ApiOptions) => Promise<ApiResult<T>>
| Param | Type |
| ------------- | ------------------------------------------------- |
| options
| ApiOptions |
Returns: Promise<ApiResult<T>>
authorize()
authorize() => Promise<void>
configure(...)
configure(options: ConfigureOptions) => Promise<void>
| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options
| ConfigureOptions |
deleteRating(...)
deleteRating(options: DeleteRatingOptions) => Promise<void>
| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| options
| DeleteRatingOptions |
echo(...)
echo(options: EchoOptions) => Promise<EchoResult>
| Param | Type |
| ------------- | --------------------------------------------------- |
| options
| EchoOptions |
Returns: Promise<EchoResult>
getCatalogAlbums(...)
getCatalogAlbums(options: GetCatalogAlbumsOptions) => Promise<GetCatalogAlbumsResult>
| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| options
| GetCatalogAlbumsOptions |
Returns: Promise<GetCatalogAlbumsResult>
getCatalogArtists(...)
getCatalogArtists(options: GetCatalogArtistsOptions) => Promise<GetCatalogArtistsResult>
| Param | Type |
| ------------- | ----------------------------------------------------------------------------- |
| options
| GetCatalogArtistsOptions |
Returns: Promise<GetCatalogArtistsResult>
getCurrentIndex()
getCurrentIndex() => Promise<GetCurrentIndexResult>
Returns: Promise<GetCurrentIndexResult>
getCurrentPlaybackDuration()
getCurrentPlaybackDuration() => Promise<GetCurrentPlaybackTimeResult>
Returns: Promise<GetCurrentPlaybackTimeResult>
getCurrentPlaybackTime()
getCurrentPlaybackTime() => Promise<GetCurrentPlaybackTimeResult>
Returns: Promise<GetCurrentPlaybackTimeResult>
getCurrentSong()
getCurrentSong() => Promise<GetCurrentSongResult>
Returns: Promise<GetCurrentSongResult>
getLibraryAlbums(...)
getLibraryAlbums(options: GetLibraryAlbumsOptions) => Promise<GetLibraryAlbumsResult>
| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| options
| GetLibraryAlbumsOptions |
Returns: Promise<GetLibraryAlbumsResult>
getLibraryArtists(...)
getLibraryArtists(options: GetLibraryArtistsOptions) => Promise<GetLibraryArtistsResult>
| Param | Type |
| ------------- | ----------------------------------------------------------------------------- |
| options
| GetLibraryArtistsOptions |
Returns: Promise<GetLibraryArtistsResult>
getLibraryPlaylists(...)
getLibraryPlaylists(options: GetLibraryPlaylistsOptions) => Promise<GetLibraryPlaylistsResult>
| Param | Type |
| ------------- | --------------------------------------------------------------------------------- |
| options
| GetLibraryPlaylistsOptions |
Returns: Promise<GetLibraryPlaylistsResult>
getLibrarySongs(...)
getLibrarySongs(options: GetLibrarySongsOptions) => Promise<GetLibrarySongsResult>
| Param | Type |
| ------------- | ------------------------------------------------------------------------- |
| options
| GetLibrarySongsOptions |
Returns: Promise<GetLibrarySongsResult>
getQueueSongs()
getQueueSongs() => Promise<GetQueueSongsResult>
Returns: Promise<GetQueueSongsResult>
getRatings(...)
getRatings(options: GetRatingsOptions) => Promise<RatingsResult>
| Param | Type |
| ------------- | --------------------------------------------------------------- |
| options
| GetRatingsOptions |
Returns: Promise<RatingsResult>
getRepeatMode()
getRepeatMode() => Promise<GetRepeatModeResult>
Returns: Promise<GetRepeatModeResult>
getShuffleMode()
getShuffleMode() => Promise<GetShuffleModeResult>
Returns: Promise<GetShuffleModeResult>
hasMusicSubscription()
hasMusicSubscription() => Promise<ActionResult>
Returns: Promise<ActionResult>
isAuthorized()
isAuthorized() => Promise<ActionResult>
Returns: Promise<ActionResult>
nextPlay()
nextPlay() => Promise<void>
pause()
pause() => Promise<void>
play(...)
play(options: PlayOptions) => Promise<void>
| Param | Type |
| ------------- | --------------------------------------------------- |
| options
| PlayOptions |
previousPlay()
previousPlay() => Promise<void>
seekToTime(...)
seekToTime(options: SeekToTimeOptions) => Promise<void>
| Param | Type |
| ------------- | --------------------------------------------------------------- |
| options
| SeekToTimeOptions |
setQueue(...)
setQueue(options: SetQueueOptions) => Promise<void>
| Param | Type |
| ------------- | ----------------------------------------------------------- |
| options
| SetQueueOptions |
setRepeatMode(...)
setRepeatMode(options: SetRepeatModeOptions) => Promise<void>
| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| options
| SetRepeatModeOptions |
setShuffleMode(...)
setShuffleMode(options: SetShuffleModeOptions) => Promise<void>
| Param | Type |
| ------------- | ----------------------------------------------------------------------- |
| options
| SetShuffleModeOptions |
setSong(...)
setSong(options: SetSongOptions) => Promise<SetSongResult>
| Param | Type |
| ------------- | --------------------------------------------------------- |
| options
| SetSongOptions |
Returns: Promise<SetSongResult>
stop()
stop() => Promise<void>
unauthorize()
unauthorize() => Promise<void>
Interfaces
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove
| () => Promise<void> |
ConfigureOptions
| Prop | Type |
| ------------ | ----------------------------------- |
| config
| MusicKit.Configuration |
EchoResult
| Prop | Type |
| ----------- | ------------------- |
| value
| string |
EchoOptions
| Prop | Type |
| ----------- | ------------------- |
| value
| string |
GetMultiDataOptions
| Prop | Type |
| ------------ | --------------------- |
| ids
| string[] |
| limit
| number |
| offset
| number |
GetCurrentIndexResult
| Prop | Type |
| ----------- | ------------------- |
| index
| number |
GetCurrentPlaybackTimeResult
| Prop | Type |
| ---------- | ------------------- |
| time
| number |
GetCurrentSongResult
| Prop | Type |
| ---------- | ------------------------------- |
| item
| MusicKit.MediaItem |
GetQueueSongsResult
| Prop | Type |
| ----------- | ------------------------ |
| items
| MediaItem[] |
GetRepeatModeResult
| Prop | Type |
| ---------- | ------------------------------------------------- |
| mode
| RepeatMode |
GetShuffleModeResult
| Prop | Type |
| ---------- | --------------------------------------------------- |
| mode
| ShuffleMode |
ActionResult
| Prop | Type |
| ------------ | -------------------- |
| result
| boolean |
PlayOptions
| Prop | Type |
| ----------- | ------------------- |
| index
| number |
SeekToTimeOptions
| Prop | Type |
| ---------- | ------------------- |
| time
| number |
SetQueueOptions
| Prop | Type |
| --------- | --------------------- |
| ids
| string[] |
SetRepeatModeOptions
| Prop | Type |
| ---------- | ------------------------------------------------- |
| mode
| RepeatMode |
SetShuffleModeOptions
| Prop | Type |
| ---------- | --------------------------------------------------- |
| mode
| ShuffleMode |
SetSongResult
| Prop | Type |
| ------------------- | -------------------- |
| albumTitle
| string |
| librarySongId
| string |
| result
| boolean |
SetSongOptions
| Prop | Type |
| ------------------- | -------------------- |
| albumTitle
| string |
| forcePreview
| boolean |
| librarySongId
| string |
| previewUrl
| string |
| songId
| string |
| songTitle
| string |
Type Aliases
PlaybackStateDidChangeListener
(data: PlaybackStateDidChangeResult): void
PlaybackStateDidChangeResult
{ state: PlaybackState; }
PlaybackState
keyof typeof MusicKit.PlaybackStates
NowPlayingItemDidChangeListener
(data: NowPlayingItemDidChangeResult): void
NowPlayingItemDidChangeResult
{ index: number; item: MusicKit.MediaItem; }
AuthorizationStatusDidChangeListener
(data: AuthorizationStatusDidChangeResult): void
AuthorizationStatusDidChangeResult
{ status: AuthorizationStatus; }
AuthorizationStatus
"unavailable" | "notDetermined" | "denied" | "restricted" | "authorized"
AddRatingOptions
{ id: string; type: MusicKit.AppleMusicAPI.RatingType; value: MusicKit.Rating; }
ApiResult
MusicKit.Relationship<T> | MusicKit.SearchRelationship
ApiOptions
{ options?: MusicKit.AppleMusicAPI.Options; params?: MusicKit.AppleMusicAPI.Params; url: string; }
DeleteRatingOptions
{ id: string; type: MusicKit.AppleMusicAPI.RatingType; }
GetCatalogAlbumsResult
MusicKit.Relationship<MusicKit.Albums>
GetCatalogAlbumsOptions
{ artistId?: string; libraryId?: string; musicVideoId?: string; songId?: string; } & GetMultiDataOptions
GetCatalogArtistsResult
MusicKit.Relationship<MusicKit.Artists>
GetCatalogArtistsOptions
{ albumId?: string; libraryId?: string; musicVideoId?: string; songId?: string; songIdForComposers?: string; } & GetMultiDataOptions
GetLibraryAlbumsResult
MusicKit.Relationship<MusicKit.LibraryAlbums>
GetLibraryAlbumsOptions
{ artistId?: string; catalogId?: string; musicVideoId?: string; songId?: string; } & GetMultiDataOptions
GetLibraryArtistsResult
MusicKit.Relationship<MusicKit.LibraryArtists>
GetLibraryArtistsOptions
{ albumId?: string; musicVideoId?: string; songId?: string; } & GetMultiDataOptions
GetLibraryPlaylistsResult
MusicKit.Relationship<MusicKit.LibraryPlaylists>
GetLibraryPlaylistsOptions
{ catalogId?: string; } & GetMultiDataOptions
GetLibrarySongsResult
MusicKit.Relationship<MusicKit.LibrarySongs>
GetLibrarySongsOptions
{ albumId?: string; catalogId?: string; playlistId?: string; } & GetMultiDataOptions
RatingsResult
MusicKit.Relationship<MusicKit.Ratings>
GetRatingsOptions
{ ids: string[]; type: MusicKit.AppleMusicAPI.RatingType; }
RepeatMode
"none" | "one" | "all"
ShuffleMode
"off" | "songs"