public void initPlay() { // 跳到指定位置播放,一种是暂停位置,一种是拖动后的位置 mediaPlayer.setOnSeekCompleteListener(new OnSeekCompleteListener() { @Override public void onSeekComplete(MediaPlayer mp) { Intent intent = new Intent(); intent.setAction("seekComplete"); if (secondPause != -1) { intent.putExtra("seek", false); intent.putExtra("pause", secondPause); } else { intent.putExtra("seek", Msg_Music.SEEK); } sendBroadcast(intent); } }); }
public void setOnSeekCompleteListener(OnSeekCompleteListener l) { this.mOnSeekCompleteListener = l; }
public OnSeekCompleteListener getOnSeekCompleteListener() { return this.mOnSeekCompleteListener; }
public void setOnSeekCompleteListener(OnSeekCompleteListener mOnSeekCompleteListener) { this.mOnSeekCompleteListener = mOnSeekCompleteListener; }
public void setOnSeekCompleteListener(OnSeekCompleteListener listener) { this.mOnSeekCompleteListener = listener; }
public void setOnSeekCompleteListener(OnSeekCompleteListener l) { if (mediaPlayer != null) this.seekCompleteListener = l; else throw new RuntimeException("Media Player is not initialized"); }
public boolean setAudioItem(AudioItem item, OnPreparedListener onPreparedListener, OnSeekCompleteListener onSeekCompleteListener, OnErrorListener onErrorListener, final OnBufferingUpdateListener onBufferingUpdateListener, OnCompletionListener onCompletionListener) { if (onPreparedListener != null) mMediaPlayer.setOnPreparedListener(onPreparedListener); if (onErrorListener != null) mMediaPlayer.setOnErrorListener(onErrorListener); MediaPlayer.OnBufferingUpdateListener bufferListenerProxy = new MediaPlayer.OnBufferingUpdateListener() { public void onBufferingUpdate(MediaPlayer mp, int percent) { if(percent == 100) doneBuffering = true; if (onBufferingUpdateListener != null) onBufferingUpdateListener.onBufferingUpdate(mp, percent); } }; mMediaPlayer.setOnBufferingUpdateListener(bufferListenerProxy); if (onSeekCompleteListener != null) mMediaPlayer.setOnSeekCompleteListener(onSeekCompleteListener); if (onCompletionListener != null) mMediaPlayer.setOnCompletionListener(onCompletionListener); if (getNowPlayingId() != item.getFileId()) { mMediaPlayer.reset(); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mAudioItem = item; String URI = mAudioItem.getFileUrl(); doneBuffering = false; if (mAudioItem.getStatus() == Status.FINISHED) URI = new File(this.getFilesDir(), mAudioItem.getPath()).getAbsolutePath(); bufferListenerProxy.onBufferingUpdate(mMediaPlayer, 100); try { mMediaPlayer.setDataSource(URI); } catch (Exception e) { Log.d(TAG, "failed to load "+URI, e); doneBuffering = true; return false; } wifiLock(); mMediaPlayer.prepareAsync(); } else { if (onPreparedListener!=null) onPreparedListener.onPrepared(mMediaPlayer); } return true; }
void setOnSeekCompleteListener(OnSeekCompleteListener onSeekCompleteListener);