It is in the development stage. Please do not use it.
npm install capacitor-plugin-applemusic
npx cap sync
echo(...)
configure(...)
isAuthorized()
hasMusicSubscription()
authorize()
unauthorize()
setSong(...)
getLibraryAlbum(...)
getLibraryAlbums(...)
play()
stop()
pause()
currentPlaybackDuration()
currentPlaybackTime()
seekToTime(...)
setVolume(...)
addListener(...)
addListener(...)
- Interfaces
echo(options: { value: string; }) => Promise<{ value: string; }>
Param | Type |
---|---|
options |
{ value: string; } |
Returns: Promise<{ value: string; }>
configure(options: { config: MusicKit.Config; }) => Promise<{ result: boolean; }>
Param | Type |
---|---|
options |
{ config: Config; } |
Returns: Promise<{ result: boolean; }>
isAuthorized() => Promise<{ result: boolean; }>
Returns: Promise<{ result: boolean; }>
hasMusicSubscription() => Promise<{ result: boolean; }>
Returns: Promise<{ result: boolean; }>
authorize() => Promise<{ result: boolean; }>
Returns: Promise<{ result: boolean; }>
unauthorize() => Promise<{ result: boolean; }>
Returns: Promise<{ result: boolean; }>
setSong(options: { songId: string; librarySongId?: string; previewUrl?: string; songTitle?: string; albumTitle?: string; forcePreview?: boolean; }) => Promise<{ result: boolean; librarySongId?: string; albumTitle?: string; }>
Param | Type |
---|---|
options |
{ songId: string; librarySongId?: string; previewUrl?: string; songTitle?: string; albumTitle?: string; forcePreview?: boolean; } |
Returns: Promise<{ result: boolean; librarySongId?: string; albumTitle?: string; }>
getLibraryAlbum(options: { id?: string; title?: string; }) => Promise<{ result: boolean; album?: { title: string; id: string; tracks: { title: string; id: string; discNumber: string; trackNumber: string; }[]; }; }>
Param | Type |
---|---|
options |
{ id?: string; title?: string; } |
Returns: Promise<{ result: boolean; album?: { title: string; id: string; tracks: { title: string; id: string; discNumber: string; trackNumber: string; }[]; }; }>
getLibraryAlbums(options: { limit: number; offset: number; }) => Promise<{ result: boolean; albums: { title: string; id: string; artworkUrl?: string; }[]; hasNext: boolean; }>
Param | Type |
---|---|
options |
{ limit: number; offset: number; } |
Returns: Promise<{ result: boolean; albums: { title: string; id: string; artworkUrl?: string; }[]; hasNext: boolean; }>
play() => Promise<{ result: boolean; }>
Returns: Promise<{ result: boolean; }>
stop() => Promise<{ result: boolean; }>
Returns: Promise<{ result: boolean; }>
pause() => Promise<{ result: boolean; }>
Returns: Promise<{ result: boolean; }>
currentPlaybackDuration() => Promise<{ result: number; }>
Returns: Promise<{ result: number; }>
currentPlaybackTime() => Promise<{ result: number; }>
Returns: Promise<{ result: number; }>
seekToTime(options: { playbackTime: number; }) => Promise<{ result: boolean; }>
Param | Type |
---|---|
options |
{ playbackTime: number; } |
Returns: Promise<{ result: boolean; }>
setVolume(options: { volume: number; }) => Promise<{ result: boolean; }>
Param | Type |
---|---|
options |
{ volume: number; } |
Returns: Promise<{ result: boolean; }>
addListener(eventName: 'playbackStateDidChange', listenerFunc: PlaybackStateDidChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type |
---|---|
eventName |
"playbackStateDidChange" |
listenerFunc |
(state: { result: "none" | "loading" | "playing" | "paused" | "stopped" | "ended" | "seeking" | "waiting" | "stalled" | "completed"; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: 'authorizationStatusDidChange', listenerFunc: AuthorizationStatusDidChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type |
---|---|
eventName |
"authorizationStatusDidChange" |
listenerFunc |
(state: { result: AuthorizationStatus; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Prop | Type |
---|---|
remove |
() => Promise<void> |