Giter VIP home page Giter VIP logo

cordovaapplemusic's Introduction

CordovaAppleMusic

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.

Installation

cordova plugin add cordova-plugin-applemusic

Usage

Initialize the plugin

appleMusic.init(successFunction, failureFunction)  

Run init() to listen to native events.

Request Authorization

appleMusic.requestAuthorization(function(isAuthorized){}, failureFunction) 

Get Play Lists

  appleMusic.getPlayLists(function(playLists){}, failureFunction) 

Return: playLists is an array with each index containing id, name fields;

Get Songs

appleMusic.getSongs(playListId, function(songList){}, failureFunction) 

Return: songList is an array with each index containing id, name fields;

Create Play List with Songs

appleMusic.createPlayList(playListName, trackIds, function(status){}, failureFunction) 

return: status success on play list creation.

Add Single Song to Playlist

appleMusic.addSongstoPlayList(playListId, trackId,  function(status){}, failureFunction) 

Return: status success on song addition. Arguments: Playlist id, array of track ids

Player

Play a Track

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.

Get Current Track Duration

appleMusicPlugin.getDuration(successFunction, failureFunction)

Returns the current track's duration (in seconds)

Get Current Track Position

appleMusicPlugin.getPosition(successFunction, failureFunction)

Returns the current track's position (in seconds)

Other Methods

appleMusicPlugin.pause(successFunction, failureFunction)

appleMusicPlugin.resume(successFunction, failureFunction)

appleMusicPlugin.seek(seconds, successFunction, failureFunction)

appleMusicPlugin.stop(successFunction, failureFunction)

EVENTS

The following methods will allow you to set up event handlers for the apple music player.

Track stopped playing

appleMusicPlugin.onStop(callback)

Called whenever an apple music track is stopped, interrupted, or paused.

Track seeked

appleMusicPlugin.onSeek(callback)

Called when the user seeks a new position within a track

Track started playing

appleMusicPlugin.onPlay(callback)

Called whenever an apple music track starts playing

cordovaapplemusic's People

Contributors

khevamann avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

cordovaapplemusic's Issues

playlist creation

i'm facing some issues while i try to create playlist.the problem is that, it creates the playlist successfully but the songs are not there in the playlist.i have given all the corresponding trackIDs for the songs(in an array as your documentation suggested). what might have gone wrong, could you please help me

unable to create playlist

i have tried the command but it returns
Error Domain=MPErrorDomain Code=2 "The requested operation is not enabled for this device." UserInfo={NSLocalizedDescription=The requested operation is not enabled for this device.}.
please help .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.