Methods Summary |
---|
private void | cleanupMediaPlayer()
if (mMediaPlayer != null) {
try {
mMediaPlayer.stop();
mMediaPlayer.release();
} finally {
mMediaPlayer = null;
}
}
|
protected void | onFinishInflate()
mNameView = (TextView) findViewById(R.id.audio_name);
mAlbumView = (TextView) findViewById(R.id.album_name);
mArtistView = (TextView) findViewById(R.id.artist_name);
mErrorMsgView = (TextView) findViewById(R.id.audio_error_msg);
|
private void | onPlaybackError()
Log.e(TAG, "Error occurred while playing audio.");
showErrorMessage(mRes.getString(R.string.cannot_play_audio));
stopAudio();
|
public void | pauseAudio()
// TODO Auto-generated method stub
|
public void | pauseVideo()
// TODO Auto-generated method stub
|
public void | reset()
synchronized (this) {
if (mIsPlaying) {
stopAudio();
}
}
mErrorMsgView.setVisibility(GONE);
|
public void | seekAudio(int seekTo)
// TODO Auto-generated method stub
|
public void | seekVideo(int seekTo)
// TODO Auto-generated method stub
|
public void | setAudio(android.net.Uri audio, java.lang.String name, java.util.Map extras)
synchronized (this) {
mAudioUri = audio;
}
mNameView.setText(name);
mAlbumView.setText((String) extras.get("album"));
mArtistView.setText((String) extras.get("artist"));
|
public void | setImage(java.lang.String name, android.graphics.Bitmap bitmap)
// TODO Auto-generated method stub
|
public void | setImageRegionFit(java.lang.String fit)
// TODO Auto-generated method stub
|
public void | setImageVisibility(boolean visible)
// TODO Auto-generated method stub
|
public void | setText(java.lang.String name, java.lang.String text)
// TODO Auto-generated method stub
|
public void | setTextVisibility(boolean visible)
// TODO Auto-generated method stub
|
public void | setVideo(java.lang.String name, android.net.Uri video)
// TODO Auto-generated method stub
|
public void | setVideoVisibility(boolean visible)
// TODO Auto-generated method stub
|
public void | setVisibility(boolean visible)
// TODO Auto-generated method stub
|
private void | showErrorMessage(java.lang.String msg)
mErrorMsgView.setText(msg);
mErrorMsgView.setVisibility(VISIBLE);
|
public synchronized void | startAudio()
if (!mIsPlaying && (mAudioUri != null)) {
mMediaPlayer = MediaPlayer.create(mContext, mAudioUri);
if (mMediaPlayer != null) {
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setOnCompletionListener(new OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
stopAudio();
}
});
mMediaPlayer.setOnErrorListener(new OnErrorListener() {
public boolean onError(MediaPlayer mp, int what, int extra) {
onPlaybackError();
return true;
}
});
mIsPlaying = true;
mMediaPlayer.start();
}
}
|
public void | startVideo()
// TODO Auto-generated method stub
|
public synchronized void | stopAudio()
try {
cleanupMediaPlayer();
} finally {
mIsPlaying = false;
}
|
public void | stopVideo()
// TODO Auto-generated method stub
|