@koodos/apple-music-capacitor-plugin
v0.0.2
Published
Apple Music
Readme
apple-music
This plugin integrates Swift's MusicKit framework (available on iOS 15.0+), to retrieve the Apple Music developer token and user token.
Setup
Add
NSAppleMusicUsageDescriptionto yourInfo.plist, describing why your app needs access to the user's Apple Music account.Follow this guide to enable MusicKit App Service for your App ID, in the Apple Developer Portal.
Install
npm install apple-music
npx cap syncUsage
Refer to the API documentation below.
For standard usage:
- Call
authorize()to request authorization from the user. - Call
hasMusicSubscription()to check if the user has an active Apple Music subscription. - Call
getDeveloperToken()to retrieve the developer token. UseignoreCache: trueif you're unsure if the cached token is still valid. - Call
getUserToken()to retrieve the user token, providing thedeveloperTokenargument. UseignoreCache: trueif you're unsure if the cached token is still valid.
API
isAuthorized()
isAuthorized() => anyReturns: any
hasMusicSubscription()
hasMusicSubscription() => anyReturns: any
authorize()
authorize() => anyReturns: any
unauthorize()
unauthorize() => anyReturns: any
getDeveloperToken(...)
getDeveloperToken(data?: { ignoreCache?: boolean | undefined; } | undefined) => any| Param | Type |
| ---------- | --------------------------------------- |
| data | { ignoreCache?: boolean; } |
Returns: any
getUserToken(...)
getUserToken(data: { developerToken: string; ignoreCache?: boolean; }) => any| Param | Type |
| ---------- | --------------------------------------------------------------- |
| data | { developerToken: string; ignoreCache?: boolean; } |
Returns: any
