0.0.2 • Published 1 year ago

@koodos/apple-music-capacitor-plugin v0.0.2

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
1 year ago

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

  1. Add NSAppleMusicUsageDescription to your Info.plist, describing why your app needs access to the user's Apple Music account.

  2. Follow this guide to enable MusicKit App Service for your App ID, in the Apple Developer Portal.

Install

npm install apple-music
npx cap sync

Usage

Refer to the API documentation below.

For standard usage:

  1. Call authorize() to request authorization from the user.
  2. Call hasMusicSubscription() to check if the user has an active Apple Music subscription.
  3. Call getDeveloperToken() to retrieve the developer token. Use ignoreCache: true if you're unsure if the cached token is still valid.
  4. Call getUserToken() to retrieve the user token, providing the developerToken argument. Use ignoreCache: true if you're unsure if the cached token is still valid.

API

isAuthorized()

isAuthorized() => any

Returns: any


hasMusicSubscription()

hasMusicSubscription() => any

Returns: any


authorize()

authorize() => any

Returns: any


unauthorize()

unauthorize() => any

Returns: any


getDeveloperToken(...)

getDeveloperToken(data?: { ignoreCache?: boolean | undefined; } | undefined) => any
ParamType
data{ ignoreCache?: boolean; }

Returns: any


getUserToken(...)

getUserToken(data: { developerToken: string; ignoreCache?: boolean; }) => any
ParamType
data{ developerToken: string; ignoreCache?: boolean; }

Returns: any


0.0.2

1 year ago

0.0.1

2 years ago