本文整理汇总了Java中android.media.MediaPlayer.OnBufferingUpdateListener类的典型用法代码示例。如果您正苦于以下问题:Java OnBufferingUpdateListener类的具体用法?Java OnBufferingUpdateListener怎么用?Java OnBufferingUpdateListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnBufferingUpdateListener类属于android.media.MediaPlayer包,在下文中一共展示了OnBufferingUpdateListener类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setOnBufferingUpdateListener
import android.media.MediaPlayer.OnBufferingUpdateListener; //导入依赖的package包/类
public void setOnBufferingUpdateListener(OnBufferingUpdateListener l) {
this.mOnBufferingUpdateListener = l;
}
示例2: setOnBufferingUpdateListener
import android.media.MediaPlayer.OnBufferingUpdateListener; //导入依赖的package包/类
public void setOnBufferingUpdateListener(OnBufferingUpdateListener listener) {
this.mOnBufferingUpdateListener = listener;
}
示例3: setOnBufferingUpdateListener
import android.media.MediaPlayer.OnBufferingUpdateListener; //导入依赖的package包/类
public void setOnBufferingUpdateListener(OnBufferingUpdateListener l) {
if (mediaPlayer != null) {
this.bufferingUpdateListener = l;
this.mediaPlayer.setOnBufferingUpdateListener(this);
} else throw new RuntimeException("Media Player is not initialized");
}
示例4: setAudioItem
import android.media.MediaPlayer.OnBufferingUpdateListener; //导入依赖的package包/类
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;
}
示例5: setOnBufferingUpdateListener
import android.media.MediaPlayer.OnBufferingUpdateListener; //导入依赖的package包/类
void setOnBufferingUpdateListener(OnBufferingUpdateListener onBufferingUpdateListener);