Created
April 26, 2013 20:53
-
-
Save lmeadors/5470368 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void handleStartIntent(Intent intent) { | |
Log.d(TAG, "*** start intent"); | |
final String outcome = intent.getStringExtra(SessionManager.START); | |
final Integer contentId = intent.getIntExtra(SessionManager.CONTENT_ID, -1); | |
final Integer patronId = intent.getIntExtra(SessionManager.PATRON_ID, -1); | |
final Integer seconds = intent.getIntExtra(SessionManager.SECONDS, 0); | |
final Integer milliseconds = seconds * 1000; // milliseconds needed for VideoView/MediaPlayer | |
Log.d(TAG, " - status: " + outcome); | |
Log.d(TAG, " - contentId: " + contentId); | |
Log.d(TAG, " - patronId: " + patronId); | |
Log.d(TAG, " - seconds: " + seconds); | |
Log.d(TAG, " - kindName: " + kindName); | |
if (ResponseStatus.OK.name().equals(outcome)) { | |
Log.d(TAG, "creating an audio thread for session and position service access"); | |
executorTimer.shutdownNow(); | |
startTimer(contentId, patronId); | |
// only seek if we have an Audiobook | |
if (!KindName.isMusic(kindName) && mediaPlayer.getCurrentPosition() < 1) { | |
Log.d(TAG, "seeking to " + milliseconds); | |
Log.d(TAG, "playing? " + mediaPlayer.isPlaying()); | |
mediaPlayer.start(); | |
mediaPlayer.seekTo(milliseconds); | |
}else { | |
mediaPlayer.start(); | |
} | |
Log.d(TAG, "mediaPlayer"); | |
Log.d(TAG, " .getCurrentPosition(): " + mediaPlayer.getCurrentPosition()); | |
Log.d(TAG, " .isPlaying(): " + mediaPlayer.isPlaying()); | |
} else { | |
final String message = intent.getStringExtra(SessionManager.MESSAGE); | |
if (contentId.equals(this.content.getId())) { | |
abortPlayback(message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment