flight-controls-capacitor
v0.0.3
Published
Music Control Notification Implementation in Android for Capacitor
Readme
music-controls-capacitor
Music Control Notification Implementation in Android for Capacitor
Install
npm install music-controls-capacitor
npx cap syncAPI
create(...)destroy()updateIsPlaying(...)updateElapsed(...)updateDismissible(...)update(...)addListener(...)- Interfaces
create(...)
create(options: CapacitorMusicControlsInfo) => anyCreate the media controls
| Param | Type |
| ------------- | --------------------------------------------------------------------------------- |
| options | CapacitorMusicControlsInfo |
Returns: any
destroy()
destroy() => anyDestroy the media controller
Returns: any
updateIsPlaying(...)
updateIsPlaying(isPlaying: boolean) => voidToggle play/pause:
| Param | Type |
| --------------- | -------------------- |
| isPlaying | boolean |
updateElapsed(...)
updateElapsed(args: { elapsed: string; isPlaying: boolean; }) => voidUpdate elapsed time, optionally toggle play/pause:
| Param | Type |
| ---------- | ----------------------------------------------------- |
| args | { elapsed: string; isPlaying: boolean; } |
updateDismissible(...)
updateDismissible(dismissible: boolean) => voidToggle dismissible:
| Param | Type |
| ----------------- | -------------------- |
| dismissible | boolean |
update(...)
update(args: { track: string; artist: string; cover: string; isPlaying: boolean; dismissible: boolean; }) => voidToggle play/pause && dismissible:
| Param | Type |
| ---------- | -------------------------------------------------------------------------------------------------------- |
| args | { track: string; artist: string; cover: string; isPlaying: boolean; dismissible: boolean; } |
addListener(...)
addListener(eventName: 'controlsNotification', listenerFunc: ControlsNotificationListener) => Promise<PluginListenerHandle> & PluginListenerHandleListen 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 |
