Access Apple Music from Cordova. I built this plugin to extend zwand19's plugin, and provides other features that the original plugin does not have. Please feel free to ask me any questions you may have.
cordova plugin add cordova-plugin-applemusic
appleMusic.init(successFunction, failureFunction)
Run init()
to listen to native events.
appleMusic.requestAuthorization(function(isAuthorized){}, failureFunction)
appleMusic.getPlayLists(function(playLists){}, failureFunction)
Return: playLists is an array with each index containing id, name fields;
appleMusic.getSongs(playListId, function(songList){}, failureFunction)
Return: songList is an array with each index containing id, name fields;
appleMusic.createPlayList(playListName, trackIds, function(status){}, failureFunction)
return: status success on play list creation.
appleMusic.addSongstoPlayList(playListId, trackId, function(status){}, failureFunction)
Return: status success on song addition. Arguments: Playlist id, array of track ids
appleMusicPlugin.playTrack(trackId, successFunction, failureFunction)
Queues a track by id.
Example id: itunes.apple.com/fr/album/unstoppable/id984653860?i=984653861
The following methods will allow you to manipulate the currently playing track.
appleMusicPlugin.getDuration(successFunction, failureFunction)
Returns the current track's duration (in seconds)
appleMusicPlugin.getPosition(successFunction, failureFunction)
Returns the current track's position (in seconds)
appleMusicPlugin.pause(successFunction, failureFunction)
appleMusicPlugin.resume(successFunction, failureFunction)
appleMusicPlugin.seek(seconds, successFunction, failureFunction)
appleMusicPlugin.stop(successFunction, failureFunction)
The following methods will allow you to set up event handlers for the apple music player.
appleMusicPlugin.onStop(callback)
Called whenever an apple music track is stopped, interrupted, or paused.
appleMusicPlugin.onSeek(callback)
Called when the user seeks a new position within a track
appleMusicPlugin.onPlay(callback)
Called whenever an apple music track starts playing