0.0.3 • Published 3 years ago
flight-controls-capacitor v0.0.3
music-controls-capacitor
Music Control Notification Implementation in Android for Capacitor
Install
npm install music-controls-capacitor
npx cap sync
API
create(...)
destroy()
updateIsPlaying(...)
updateElapsed(...)
updateDismissible(...)
update(...)
addListener(...)
- Interfaces
create(...)
create(options: CapacitorMusicControlsInfo) => any
Create the media controls
Param | Type |
---|---|
options | CapacitorMusicControlsInfo |
Returns: any
destroy()
destroy() => any
Destroy the media controller
Returns: any
updateIsPlaying(...)
updateIsPlaying(isPlaying: boolean) => void
Toggle play/pause:
Param | Type |
---|---|
isPlaying | boolean |
updateElapsed(...)
updateElapsed(args: { elapsed: string; isPlaying: boolean; }) => void
Update elapsed time, optionally toggle play/pause:
Param | Type |
---|---|
args | { elapsed: string; isPlaying: boolean; } |
updateDismissible(...)
updateDismissible(dismissible: boolean) => void
Toggle dismissible:
Param | Type |
---|---|
dismissible | boolean |
update(...)
update(args: { track: string; artist: string; cover: string; isPlaying: boolean; dismissible: boolean; }) => void
Toggle play/pause && dismissible:
Param | Type |
---|---|
args | { track: string; artist: string; cover: string; isPlaying: boolean; dismissible: boolean; } |
addListener(...)
addListener(eventName: 'controlsNotification', listenerFunc: ControlsNotificationListener) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for updates from the notification
Param | Type |
---|---|
eventName | "controlsNotification" |
listenerFunc | (info: CapacitorMusicControlsInfo) => void |
Returns: any
Interfaces
CapacitorMusicControlsInfo
Prop | Type |
---|---|
track | string |
artist | string |
cover | string |
isPlaying | boolean |
dismissible | boolean |
hasPrev | boolean |
hasNext | boolean |
hasSkipForward | boolean |
hasSkipBackward | boolean |
skipForwardInterval | number |
skipBackwardInterval | number |
hasScrubbing | boolean |
hasClose | boolean |
album | string |
duration | number |
elapsed | number |
ticker | string |
playIcon | string |
pauseIcon | string |
prevIcon | string |
nextIcon | string |
closeIcon | string |
notificationIcon | string |
PluginListenerHandle
Prop | Type |
---|---|
remove | () => any |