Example usage for org.apache.cordova AudioPlayer destroy

List of usage examples for org.apache.cordova AudioPlayer destroy

Introduction

In this page you can find the example usage for org.apache.cordova AudioPlayer destroy.

Prototype

public void destroy() 

Source Link

Document

Destroy player and stop audio playing or recording.

Usage

From source file:com.candygram.media.AudioHandler.java

License:Apache License

/**
 * Stop all audio players and recorders.
 *///w ww . j a v a 2 s .c  om
public void onDestroy() {
    if (!players.isEmpty()) {
        onLastPlayerReleased();
    }
    for (AudioPlayer audio : this.players.values()) {
        audio.destroy();
    }
    this.players.clear();
}

From source file:com.candygram.media.AudioHandler.java

License:Apache License

/**
 * Release the audio player instance to save memory.
 * @param id            The id of the audio player
 *///from   w  w w  .  j a  v  a  2s.c  o  m
private boolean release(String id) {
    AudioPlayer audio = players.remove(id);
    if (audio == null) {
        return false;
    }
    if (players.isEmpty()) {
        onLastPlayerReleased();
    }
    audio.destroy();
    return true;
}