Created
August 5, 2014 06:57
-
-
Save j-onathan/8608084329da66dcbc2c to your computer and use it in GitHub Desktop.
Android Code Example: Playing audio and video (from http://www.codota.com/android/scenarios/52fcbcdada0a1f9f8d94bf01/playing-audio-and-video?tag=dragonfly)
This file contains hidden or 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 invokePlay( Boolean loop ) | |
{ | |
Boolean playing = ( mp.isLooping() || mp.isPlaying() ); | |
if ( playing ) | |
{ | |
mp.pause(); | |
mp.setLooping(loop); | |
mp.seekTo(0); | |
mp.start(); | |
} | |
if ( !playing && state == PREPARED ) | |
{ | |
state = PENDING_LOOP; | |
onPrepared( mp ); | |
} | |
else if ( !playing ) | |
{ | |
state = PENDING_LOOP; | |
mp.setLooping(loop); | |
mp.start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment