npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-apple-music

v0.2.5

Published

Queue up songs to play using an Apple Music premium account

Downloads

9

Readme

Cordova Apple Music Plugin

Allows applications to determine whether or not the phone has a registered Apple Music account. If it does, allows queueing up songs to be played in Apple Music. Also contains some methods to manage the currently playing track.

cordova plugin add cordova-plugin-apple-music

API

Apple Music Methods

The following methods integrate with the new Apple Music API released in iOS 9.3.

Initialize the Plugin

appleMusicPlugin.init(successFunction, failureFunction)

Only necessary if you want to respond to the plugin's events

Get Authorization Status

appleMusicPlugin.getStatus(function(statusCode){}, failureFunction)

0 - SKCloudServiceAuthorizationStatusNotDetermined

1 - SKCloudServiceAuthorizationStatusDenied

2 - SKCloudServiceAuthorizationStatusAuthorized

3 - SKCloudServiceAuthorizationStatusRestricted

enum documentation

Request Authorization

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

This will prompt the user asking if the application can have access to apple music. Calling this multiple times will not show the prompt more than once, if the user does not permit access the first time. Users must go into Settings -> AppName in order to grant access after the first prompt. Returns whether or not the phone will be app will be capable of queueing songs for playback.

Get Country Code

appleMusicPlugin.getCountryCode(successFunction, failureFunction)

Returns the country code for the iTunes storefront

Play a Track

appleMusicPlugin.playTrack(trackId, successFunction, failureFunction)

Queues a track by id.

Example id: itunes.apple.com/fr/album/unstoppable/id984653860?i=984653861

Music Player Methods

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