use of com.getcapacitor.JSObject in project capacitor-music-controls-plugin-new by gokadzev.
the class MediaSessionCallback method onSkipToNext.
@Override
public void onSkipToNext() {
super.onSkipToNext();
JSObject ret = new JSObject();
ret.put("message", "music-controls-media-button-next");
this.musicControls.controlsNotification(ret);
// if(this.cb != null) {
// this.cb.success("{\"message\": \"music-controls-media-button-next\"}");
// this.cb = null;
// }
}
use of com.getcapacitor.JSObject in project capacitor-music-controls-plugin-new by gokadzev.
the class MusicControlsBroadcastReceiver method stopListening.
public void stopListening() {
JSObject ret = new JSObject();
ret.put("message", "music-controls-stop-listening");
this.musicControls.controlsNotification(ret);
}
use of com.getcapacitor.JSObject in project capacitor-music-controls-plugin-new by gokadzev.
the class CapacitorMusicControls method create.
@PluginMethod()
public void create(PluginCall call) {
JSObject options = call.getData();
this.initialize();
this.updateMetadata(options);
call.resolve();
}
use of com.getcapacitor.JSObject in project capacitor-music-controls-plugin-new by gokadzev.
the class CapacitorMusicControls method updateDismissable.
@PluginMethod()
public void updateDismissable(PluginCall call) {
JSObject params = call.getData();
try {
final boolean dismissable = params.getBoolean("dismissable");
this.notification.updateDismissable(dismissable);
call.resolve();
} catch (JSONException e) {
call.reject("error in updateDismissable");
}
}
use of com.getcapacitor.JSObject in project capacitor-music-controls-plugin-new by gokadzev.
the class CapacitorMusicControls method updateState.
@PluginMethod()
public void updateState(PluginCall call) {
JSObject params = call.getData();
try {
final boolean isPlaying = params.getBoolean("isPlaying");
final long elapsed = params.getLong("elapsed");
this.notification.updateIsPlaying(isPlaying);
if (isPlaying)
this.setMediaPlaybackState(PlaybackStateCompat.STATE_PLAYING, elapsed);
else
this.setMediaPlaybackState(PlaybackStateCompat.STATE_PAUSED, elapsed);
call.resolve();
} catch (JSONException e) {
call.reject("error in updateState");
}
}
Aggregations