List of usage examples for android.media MediaPlayer setOnSeekCompleteListener
public void setOnSeekCompleteListener(OnSeekCompleteListener listener)
From source file:com.cw.litenote.util.video.UtilVideo.java
static void setVideoPlayerListeners(final ViewPager pager, final String picString) { // on complete listener mVideoView.setOnCompletionListener(new OnCompletionListener() { @Override/*from www . ja v a 2 s . c om*/ public void onCompletion(MediaPlayer mp) { System.out.println("UtilVideo / _setOnCompletionListener / _onCompletion"); mPlayVideoPosition = 0; setVideoState(VIDEO_AT_PAUSE); if (!hasMediaControlWidget) NoteUi.updateVideoPlayButtonState(pager, mPlayVideoPosition); } }); // on prepared listener mVideoView.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { System.out.println("UtilVideo / _setOnPreparedListener"); if (!hasMediaControlWidget) { NoteUi.updateVideoPlayButtonState(pager, mPlayVideoPosition); NoteUi.primaryVideoSeekBarProgressUpdater(pager, NoteUi.getFocus_notePos(), UtilVideo.mPlayVideoPosition, picString); mp.setOnSeekCompleteListener(new OnSeekCompleteListener() { @Override public void onSeekComplete(MediaPlayer mp) { } }); } } }); }
From source file:com.yohpapa.research.simplemusicplayer.PlaybackService.java
private MediaPlayer initializePlayer() { MediaPlayer player = new MediaPlayer(); player.setAudioStreamType(AudioManager.STREAM_MUSIC); player.setOnPreparedListener(this); player.setOnCompletionListener(this); player.setOnErrorListener(this); player.setOnSeekCompleteListener(this); player.setWakeMode(this, PowerManager.PARTIAL_WAKE_LOCK); IntentFilter filter = new IntentFilter(); filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); filter.addAction(Intent.ACTION_HEADSET_PLUG); filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED); filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED); registerReceiver(audioOutputChangedEventReceiver, filter); return player; }
From source file:com.bayapps.android.robophish.playback.LocalPlayback.java
/** * Makes sure the media player exists and has been reset. This will create * the media player if needed, or reset the existing media player if one * already exists./*w w w.ja va 2s .c o m*/ */ private MediaPlayer createMediaPlayer(MediaPlayer player) { LogHelper.d(TAG, "createMediaPlayerIfNeeded. needed? ", (player == null)); if (player == null) { player = new MediaPlayer(); // Make sure the media player will acquire a wake-lock while // playing. If we don't do that, the CPU might go to sleep while the // song is playing, causing playback to stop. player.setWakeMode(mContext.getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); // we want the media player to notify us when it's ready preparing, // and when it's done playing: player.setOnPreparedListener(this); player.setOnCompletionListener(this); player.setOnErrorListener(this); player.setOnSeekCompleteListener(this); } else { player.reset(); } return player; }