Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 920 Bytes

README.md

File metadata and controls

48 lines (34 loc) · 920 Bytes

react-native-apple-music

Getting started

$ npm install @pkhien/react-native-apple-music --save

Mostly automatic installation

React Native 0.59+:

$ cd ios && pod install

React Native <0.59

$ react-native link react-native-apple-music

Usage

1. Authorization

import {Auth} from 'react-native-apple-music'

Auth.requestAuthorization()
  .then(authorizationStatus => {})
  .catch(error => {})

Auth.getStoreFrontCountryCode()
  .then(code => {})
  .catch(error => {})

Auth.requestUserToken('<developerToken>')
  .then(userToken => {})
  .catch(error => {})

Auth.requestCapabilities()
  .then(capability => {})
  .catch(error => {})

2. Media Player

import {MediaPlayer} from 'react-native-apple-music'

MediaPlayer.setQueue(['storeId1', 'storeId2'])
MediaPlayer.play()
MediaPlayer.pause()
MediaPlayer.play() // Play again to resume
MediaPlayer.stop()