Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/himanushi/capacitor-plugin-musickit
https://github.com/himanushi/capacitor-plugin-musickit
apple-music capacitor capacitor-plugin musickit musickitjs swift typescript
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/himanushi/capacitor-plugin-musickit
- Owner: himanushi
- Created: 2022-09-22T04:32:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-19T01:56:08.000Z (over 1 year ago)
- Last Synced: 2024-04-26T14:45:46.683Z (8 months ago)
- Topics: apple-music, capacitor, capacitor-plugin, musickit, musickitjs, swift, typescript
- Language: Swift
- Homepage:
- Size: 1.51 MB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# capacitor-plugin-musickit
Requires iOS 16 or higher
## Install
```bash
npm install capacitor-plugin-musickit
npx cap sync
```## API
* [`addListener('playbackStateDidChange', ...)`](#addlistenerplaybackstatedidchange)
* [`addListener('nowPlayingItemDidChange', ...)`](#addlistenernowplayingitemdidchange)
* [`addListener('authorizationStatusDidChange', ...)`](#addlistenerauthorizationstatusdidchange)
* [`addRating(...)`](#addrating)
* [`api(...)`](#api)
* [`authorize()`](#authorize)
* [`configure(...)`](#configure)
* [`deleteRating(...)`](#deleterating)
* [`echo(...)`](#echo)
* [`getCatalogAlbums(...)`](#getcatalogalbums)
* [`getCatalogArtists(...)`](#getcatalogartists)
* [`getCurrentIndex()`](#getcurrentindex)
* [`getCurrentPlaybackDuration()`](#getcurrentplaybackduration)
* [`getCurrentPlaybackTime()`](#getcurrentplaybacktime)
* [`getCurrentSong()`](#getcurrentsong)
* [`getLibraryAlbums(...)`](#getlibraryalbums)
* [`getLibraryArtists(...)`](#getlibraryartists)
* [`getLibraryPlaylists(...)`](#getlibraryplaylists)
* [`getLibrarySongs(...)`](#getlibrarysongs)
* [`getQueueSongs()`](#getqueuesongs)
* [`getRatings(...)`](#getratings)
* [`getRepeatMode()`](#getrepeatmode)
* [`getShuffleMode()`](#getshufflemode)
* [`hasMusicSubscription()`](#hasmusicsubscription)
* [`isAuthorized()`](#isauthorized)
* [`nextPlay()`](#nextplay)
* [`pause()`](#pause)
* [`play(...)`](#play)
* [`previousPlay()`](#previousplay)
* [`seekToTime(...)`](#seektotime)
* [`setQueue(...)`](#setqueue)
* [`setRepeatMode(...)`](#setrepeatmode)
* [`setShuffleMode(...)`](#setshufflemode)
* [`setSong(...)`](#setsong)
* [`stop()`](#stop)
* [`unauthorize()`](#unauthorize)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)### addListener('playbackStateDidChange', ...)
```typescript
addListener(eventName: "playbackStateDidChange", listenerFunc: PlaybackStateDidChangeListener) => Promise & PluginListenerHandle
```| Param | Type |
| ------------------ | ----------------------------------------------------------------------------------------- |
| **`eventName`** |'playbackStateDidChange'
|
| **`listenerFunc`** |PlaybackStateDidChangeListener
|**Returns:**
Promise<PluginListenerHandle> & PluginListenerHandle
--------------------
### addListener('nowPlayingItemDidChange', ...)
```typescript
addListener(eventName: "nowPlayingItemDidChange", listenerFunc: NowPlayingItemDidChangeListener) => Promise & PluginListenerHandle
```| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------------- |
| **`eventName`** |'nowPlayingItemDidChange'
|
| **`listenerFunc`** |NowPlayingItemDidChangeListener
|**Returns:**
Promise<PluginListenerHandle> & PluginListenerHandle
--------------------
### addListener('authorizationStatusDidChange', ...)
```typescript
addListener(eventName: "authorizationStatusDidChange", listenerFunc: AuthorizationStatusDidChangeListener) => Promise & PluginListenerHandle
```| Param | Type |
| ------------------ | ----------------------------------------------------------------------------------------------------- |
| **`eventName`** |'authorizationStatusDidChange'
|
| **`listenerFunc`** |AuthorizationStatusDidChangeListener
|**Returns:**
Promise<PluginListenerHandle> & PluginListenerHandle
--------------------
### addRating(...)
```typescript
addRating(options: AddRatingOptions) => Promise
```| Param | Type |
| ------------- | ------------------------------------------------------------- |
| **`options`** |AddRatingOptions
|--------------------
### api(...)
```typescript
api(options: ApiOptions) => Promise>
```| Param | Type |
| ------------- | ------------------------------------------------- |
| **`options`** |ApiOptions
|**Returns:**
Promise<ApiResult<T>>
--------------------
### authorize()
```typescript
authorize() => Promise
```--------------------
### configure(...)
```typescript
configure(options: ConfigureOptions) => Promise
```| Param | Type |
| ------------- | ------------------------------------------------------------- |
| **`options`** |ConfigureOptions
|--------------------
### deleteRating(...)
```typescript
deleteRating(options: DeleteRatingOptions) => Promise
```| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| **`options`** |DeleteRatingOptions
|--------------------
### echo(...)
```typescript
echo(options: EchoOptions) => Promise
```| Param | Type |
| ------------- | --------------------------------------------------- |
| **`options`** |EchoOptions
|**Returns:**
Promise<EchoResult>
--------------------
### getCatalogAlbums(...)
```typescript
getCatalogAlbums(options: GetCatalogAlbumsOptions) => Promise
```| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| **`options`** |GetCatalogAlbumsOptions
|**Returns:**
Promise<GetCatalogAlbumsResult>
--------------------
### getCatalogArtists(...)
```typescript
getCatalogArtists(options: GetCatalogArtistsOptions) => Promise
```| Param | Type |
| ------------- | ----------------------------------------------------------------------------- |
| **`options`** |GetCatalogArtistsOptions
|**Returns:**
Promise<GetCatalogArtistsResult>
--------------------
### getCurrentIndex()
```typescript
getCurrentIndex() => Promise
```**Returns:**
Promise<GetCurrentIndexResult>
--------------------
### getCurrentPlaybackDuration()
```typescript
getCurrentPlaybackDuration() => Promise
```**Returns:**
Promise<GetCurrentPlaybackTimeResult>
--------------------
### getCurrentPlaybackTime()
```typescript
getCurrentPlaybackTime() => Promise
```**Returns:**
Promise<GetCurrentPlaybackTimeResult>
--------------------
### getCurrentSong()
```typescript
getCurrentSong() => Promise
```**Returns:**
Promise<GetCurrentSongResult>
--------------------
### getLibraryAlbums(...)
```typescript
getLibraryAlbums(options: GetLibraryAlbumsOptions) => Promise
```| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| **`options`** |GetLibraryAlbumsOptions
|**Returns:**
Promise<GetLibraryAlbumsResult>
--------------------
### getLibraryArtists(...)
```typescript
getLibraryArtists(options: GetLibraryArtistsOptions) => Promise
```| Param | Type |
| ------------- | ----------------------------------------------------------------------------- |
| **`options`** |GetLibraryArtistsOptions
|**Returns:**
Promise<GetLibraryArtistsResult>
--------------------
### getLibraryPlaylists(...)
```typescript
getLibraryPlaylists(options: GetLibraryPlaylistsOptions) => Promise
```| Param | Type |
| ------------- | --------------------------------------------------------------------------------- |
| **`options`** |GetLibraryPlaylistsOptions
|**Returns:**
Promise<GetLibraryPlaylistsResult>
--------------------
### getLibrarySongs(...)
```typescript
getLibrarySongs(options: GetLibrarySongsOptions) => Promise
```| Param | Type |
| ------------- | ------------------------------------------------------------------------- |
| **`options`** |GetLibrarySongsOptions
|**Returns:**
Promise<GetLibrarySongsResult>
--------------------
### getQueueSongs()
```typescript
getQueueSongs() => Promise
```**Returns:**
Promise<GetQueueSongsResult>
--------------------
### getRatings(...)
```typescript
getRatings(options: GetRatingsOptions) => Promise
```| Param | Type |
| ------------- | --------------------------------------------------------------- |
| **`options`** |GetRatingsOptions
|**Returns:**
Promise<RatingsResult>
--------------------
### getRepeatMode()
```typescript
getRepeatMode() => Promise
```**Returns:**
Promise<GetRepeatModeResult>
--------------------
### getShuffleMode()
```typescript
getShuffleMode() => Promise
```**Returns:**
Promise<GetShuffleModeResult>
--------------------
### hasMusicSubscription()
```typescript
hasMusicSubscription() => Promise
```**Returns:**
Promise<ActionResult>
--------------------
### isAuthorized()
```typescript
isAuthorized() => Promise
```**Returns:**
Promise<ActionResult>
--------------------
### nextPlay()
```typescript
nextPlay() => Promise
```--------------------
### pause()
```typescript
pause() => Promise
```--------------------
### play(...)
```typescript
play(options: PlayOptions) => Promise
```| Param | Type |
| ------------- | --------------------------------------------------- |
| **`options`** |PlayOptions
|--------------------
### previousPlay()
```typescript
previousPlay() => Promise
```--------------------
### seekToTime(...)
```typescript
seekToTime(options: SeekToTimeOptions) => Promise
```| Param | Type |
| ------------- | --------------------------------------------------------------- |
| **`options`** |SeekToTimeOptions
|--------------------
### setQueue(...)
```typescript
setQueue(options: SetQueueOptions) => Promise
```| Param | Type |
| ------------- | ----------------------------------------------------------- |
| **`options`** |SetQueueOptions
|--------------------
### setRepeatMode(...)
```typescript
setRepeatMode(options: SetRepeatModeOptions) => Promise
```| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| **`options`** |SetRepeatModeOptions
|--------------------
### setShuffleMode(...)
```typescript
setShuffleMode(options: SetShuffleModeOptions) => Promise
```| Param | Type |
| ------------- | ----------------------------------------------------------------------- |
| **`options`** |SetShuffleModeOptions
|--------------------
### setSong(...)
```typescript
setSong(options: SetSongOptions) => Promise
```| Param | Type |
| ------------- | --------------------------------------------------------- |
| **`options`** |SetSongOptions
|**Returns:**
Promise<SetSongResult>
--------------------
### stop()
```typescript
stop() => Promise
```--------------------
### unauthorize()
```typescript
unauthorize() => Promise
```--------------------
### 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"