Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leon/cordova-plugin-nowplaying
Cordova Plugin Now Playing for iOS
https://github.com/leon/cordova-plugin-nowplaying
Last synced: 15 days ago
JSON representation
Cordova Plugin Now Playing for iOS
- Host: GitHub
- URL: https://github.com/leon/cordova-plugin-nowplaying
- Owner: leon
- Created: 2015-09-30T08:49:02.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-14T14:21:30.000Z (about 7 years ago)
- Last Synced: 2024-10-27T15:42:15.776Z (20 days ago)
- Language: Objective-C
- Size: 11.7 KB
- Stars: 28
- Watchers: 7
- Forks: 8
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Info
Allows setting the lock screen information such as artist, title, and artwork.https://developer.apple.com/library/prerelease/ios/documentation/MediaPlayer/Reference/MPNowPlayingInfoCenter_Class/index.html
This plugin has a sibling plugin that allows you to handle remote commands, check it out!
https://github.com/leon/cordova-plugin-remotecommand
# Install
```bash
cordova plugin add cordova-plugin-nowplaying
```# Use
> Use only the keys that you have available and leave the others out of the javascript object, that way only the correct keys will be sent to the MPNowPlayingInfoCenter.nowPlayingInfo
> It will only overwrite the values that come in by cloning the old dictionary.```javascript
NowPlaying.set({
artwork: "http://www.domain.com/image.png", // Can be http:// https:// or image path relative to NSDocumentDirectory
albumTitle: "The Album Title",
trackCount: 10,
trackNumber: 1,
artist: "The Artist",
composer: "The Composer",
discCount: 1,
discNumber: 1,
genre: "The Genre",
persistentID: 12345,
playbackDuration: 500,
title: "The Title",
elapsedPlaybackTime: 30,
playbackRate: 1,
playbackQueueIndex: 1,
playbackQueueCount: 5,
chapterNumber: 1,
chapterCount: 2
});
```You can call `NowPlaying.set` multiple times to update the keys you send in the object
```javascript
NowPlaying.set({
artwork: "http://www.domain.com/image.png"
});setTimeout(function () {
NowPlaying.set({
chapterNumber: 2
});
}, 1000);
```> When using in a browser environment it will simply log the calls to `NowPlaying.set` to the console.