@koodos/apple-music-capacitor-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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
Param Type
data { ignoreCache?: boolean; }

Returns: any


getUserToken(...)

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

Returns: any


Readme

Keywords

Package Sidebar

Install

npm i @koodos/apple-music-capacitor-plugin

Weekly Downloads

38

Version

0.0.2

License

UNLICENSED

Unpacked Size

16.2 kB

Total Files

19

Last publish

Collaborators

  • koodoslabs
  • apuchitnis