feat(music-controls): add event for ios control center seek and function to update ios elapsed time (#1727)

This commit is contained in:
Buddy Reno 2017-07-03 06:11:07 -05:00 committed by Ibby Hadeed
parent 51fc5332ff
commit 593607e914

View File

@ -58,7 +58,9 @@ export interface MusicControlsOptions {
*
* this.musicControls.subscribe().subscribe(action => {
*
* switch(action) {
* function events(action) {
* const message = JSON.parse(action).message;
* switch(message) {
* case 'music-controls-next':
* // Do something
* break;
@ -75,7 +77,21 @@ export interface MusicControlsOptions {
* // Do something
* break;
*
* // External controls (iOS only)
* case 'music-controls-toggle-play-pause' :
* // Do something
* break;
* case 'music-controls-seek-to':
* const seekToInSeconds = JSON.parse(action).position;
* MusicControls.updateElapsed({
* elapsed: seekToInSeconds,
* isPlaying: true
* });
* // Do something
* break;
*
* // Headset events (Android only)
* // All media button events are listed below
* case 'music-controls-media-button' :
* // Do something
* break;
@ -88,8 +104,7 @@ export interface MusicControlsOptions {
* default:
* break;
* }
*
* });
* }
*
* this.musicControls.listen(); // activates the observable above
*
@ -147,6 +162,15 @@ export class MusicControls extends IonicNativePlugin {
@Cordova()
updateIsPlaying(isPlaying: boolean): void { }
/**
* Update elapsed time, optionally toggle play/pause:
* @param args {elapsed: string, isPlaying: boolean}
*/
@Cordova({
platforms: ['iOS']
})
updateElapsed(args: object): void { }
/**
* Toggle dismissable:
* @param dismissable {boolean}