HI guys,
I have an activity which renders video . But when a notification pops
up (eg an alarm clock intimation ) the playback freezes and after we
dismiss it, the playback is not resumed. I would like to resume the
playback as soon as we dismiss the popup window. I am using
MediaPlayer object to play the video.
Here is a piece of my code :
public void surfaceCreated(SurfaceHolder holder) {
Log.d(TAG, "surfaceCreated called");
playVideo(path);
}
public void surfaceChanged(SurfaceHolder surfaceholder, int i, int j,
int k) {
Log.d(TAG, "surfaceChanged called");
}
public void surfaceDestroyed(SurfaceHolder surfaceholder) {
Log.d(TAG, "surfaceDestroyed called");
}
private void playVideo(String path) {
// Create a new media player and set the listeners
mMediaPlayer = new
MediaPlayer();
System.out.println("SS request
="+path);
currentChannelPath = path;
mMediaPlayer.setDataSource(path);
mMediaPlayer.setDisplay(holder);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.prepareAsync();
mMediaPlayer.setOnBufferingUpdateListener(this);
mMediaPlayer.setOnCompletionListener(this);
mMediaPlayer.setOnPreparedListener(this);
mMediaPlayer.setOnVideoSizeChangedListener(this);
mMediaPlayer.setOnErrorListener(this);
mMediaPlayer.setScreenOnWhilePlaying(true);
}
public void onPrepared(MediaPlayer mediaplayer) {
Log.d(TAG, "onPrepared called");
startVideoPlayback();
}
public void onResume()//Start thumbnails
{
super.onResume();
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en