List of usage examples for org.apache.cordova AudioPlayer pausePlaying
public void pausePlaying()
From source file:com.candygram.media.AudioHandler.java
License:Apache License
/** * Called when a message is sent to plugin. * * @param id The message id// ww w. jav a 2s. c o m * @param data The message data * @return Object to stop propagation or null */ public Object onMessage(String id, Object data) { // If phone message if (id.equals("telephone")) { // If phone ringing, then pause playing if ("ringing".equals(data) || "offhook".equals(data)) { // Get all audio players and pause them for (AudioPlayer audio : this.players.values()) { if (audio.getState() == AudioPlayer.STATE.MEDIA_RUNNING.ordinal()) { this.pausedForPhone.add(audio); audio.pausePlaying(); } } } // If phone idle, then resume playing those players we paused else if ("idle".equals(data)) { for (AudioPlayer audio : this.pausedForPhone) { audio.startPlaying(null); } this.pausedForPhone.clear(); } } return null; }
From source file:com.candygram.media.AudioHandler.java
License:Apache License
/** * Pause playing.//from w w w. jav a2s .com * @param id The id of the audio player */ public void pausePlayingAudio(String id) { AudioPlayer audio = this.players.get(id); if (audio != null) { audio.pausePlaying(); } }