danielr2001.audioplayer.enums.NotificationActionName.PLAY

Here are the examples of the java api danielr2001.audioplayer.enums.NotificationActionName.PLAY taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

18 Source : ForegroundAudioPlayer.java
with MIT License
from danielR2001

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    this.context = getApplicationContext();
    mediaSession = new MediaSessionCompat(this.context, "playback");
    // ! TODO handle MediaButtonReceiver's callbacks
    // MediaButtonReceiver.handleIntent(mediaSession, intent);
    // mediaSession.setCallback(mediaSessionCallback);
    if (intent.getAction() != null) {
        AudioObject currentAudioObject;
        if (this.playerMode == PlayerMode.PLAYLIST) {
            currentAudioObject = this.audioObjects.get(player.getCurrentWindowIndex());
        } else {
            currentAudioObject = this.audioObject;
        }
        if (intent.getAction().equals(MediaNotificationManager.PREVIOUS_ACTION)) {
            if (currentAudioObject.getNotificationActionCallbackMode() == NotificationActionCallbackMode.DEFAULT) {
                previous();
            } else {
                ref.handleNotificationActionCallback(this.foregroundAudioPlayer, NotificationActionName.PREVIOUS);
            }
        } else if (intent.getAction().equals(MediaNotificationManager.PLAY_ACTION)) {
            if (currentAudioObject.getNotificationActionCallbackMode() == NotificationActionCallbackMode.DEFAULT) {
                if (!stopped) {
                    resume();
                } else {
                    if (playerMode == PlayerMode.PLAYLIST) {
                        playAll(audioObjects, 0, 0);
                    } else {
                        play(audioObject, 0);
                    }
                }
            } else {
                ref.handleNotificationActionCallback(this.foregroundAudioPlayer, NotificationActionName.PLAY);
            }
        } else if (intent.getAction().equals(MediaNotificationManager.PAUSE_ACTION)) {
            if (currentAudioObject.getNotificationActionCallbackMode() == NotificationActionCallbackMode.DEFAULT) {
                pause();
            } else {
                ref.handleNotificationActionCallback(this.foregroundAudioPlayer, NotificationActionName.PAUSE);
            }
        } else if (intent.getAction().equals(MediaNotificationManager.NEXT_ACTION)) {
            if (currentAudioObject.getNotificationActionCallbackMode() == NotificationActionCallbackMode.DEFAULT) {
                next();
            } else {
                ref.handleNotificationActionCallback(this.foregroundAudioPlayer, NotificationActionName.NEXT);
            }
        } else if (intent.getAction().equals(MediaNotificationManager.CUSTOM1_ACTION)) {
            ref.handleNotificationActionCallback(this.foregroundAudioPlayer, NotificationActionName.CUSTOM1);
        } else if (intent.getAction().equals(MediaNotificationManager.CUSTOM2_ACTION)) {
            ref.handleNotificationActionCallback(this.foregroundAudioPlayer, NotificationActionName.CUSTOM2);
        }
    }
    return START_STICKY;
}