Playback

First get a reference to the VoiceLayerMessagePlayer:

VoiceLayerMessagePlayer player = client.getMessagePlayer();

optionally you can set a listener for playback events:

player.setPlayerEventListener(new VoiceLayerPlayerEventListener() {

    @Override
    public void onMessagePlaybackStarted(VoiceLayerMessage message) {
        // Called when a message starts playing.
    }

    @Override
    public void onMessagePlaybackPaused(VoiceLayerMessage message) {
        // Called when message playback is paused.
    }

    @Override
    public void onMessagePlaybackResumed(VoiceLayerMessage message) {
        // Called when message playback resumes.
    }

    @Override
    public void onMessagePlaybackFinished(VoiceLayerMessage message) {
        // Called when message playback finishes.
    }

    @Override
    public void onMessagePlaybackStopped(VoiceLayerMessage message) {
        // Called when message playback is stopped.
    }

    @Override
    public void onMessagePlaybackFailed(VoiceLayerMessage message, VoiceLayerException exception) {
        // Called when message playback fails.
    }

});

Play a Message

player.playMessage(message);

Pause Playback

player.pause();

After playback has been paused, player.isPaused() will return true.

Resume Playback

player.resume();

After playback has been resumed, player.isPlaying() will return true.

Stop Playback

player.stop();