I'm trying to play mp4 video in loop and i have a problem with two device (on all other devices my code works fine) Motorola Defy 2.2.1 and Motorola Atrix 4G 2.3.
The problem is after one run the media got stuck and I get this error :
08-12 17:04:15.031: W/MediaPlayer(4710): info/warning (1, 44)
08-12 17:04:15.031: I/MediaPlayer(4710): Info (1,44)
08-12 17:04:15.031: D/MediaPlayer(4710): getMetadata
08-12 17:04:30.742: W/AudioSystem(4710): AudioFlinger server died!
08-12 17:04:30.742: W/IMediaDeathNotifier(4710): media server died
08-12 17:04:30.742: E/MediaPlayer(4710): error (100, 0)
08-12 17:04:30.742: W/AudioSystem(4710): AudioPolicyService server died!
08-12 17:04:30.750: E/MediaPlayer(4710): Error (100,0)
08-12 17:04:30.750: D/VideoView(4710): Error: 100,0
08-12 17:04:30.750: E/MediaPlayer(4710): stop called in state 0
08-12 17:04:30.750: E/MediaPlayer(4710): error (-38, 0)
08-12 17:04:30.750: W/MediaPlayer(4710): mediaplayer went away with unhandled events
08-12 17:04:59.711: D/dalvikvm(4710): GC_FOR_MALLOC freed 9260 objects / 742128 bytes in 80ms
this is my code:
protected void prepareVideoView(File video, String clipId) {
// final Activity currentView = this;
final VideoView vv = (VideoView) findViewById(R.id.video);
vv.setOnErrorListener(Library_callHandler.getErrorHandler(video));
vv.setVideoPath(video.getAbsolutePath());
vv.setVisibility(View.VISIBLE);
vv.setVerticalScrollBarEnabled(false);
vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
try {
int counter = 0;
while (vv.isPlaying() && counter++ < 3) {
try {
Thread.currentThread();
Thread.sleep(100);
} catch (InterruptedException ignore) {
}
}
if (vv.isPlaying()) {
com.vringo.shared.Log
.log(com.vringo.shared.Log.LEVEL_INFO,
"VmcRingerActivity onCompletion vv.isPlaying()--> finish()");
finishInstance();
return;
}
vv.start();
} catch (IllegalStateException e) {
// ResidentService.restoreRinger(currentView);
}
}
});
vv.start();
Library_callHandler.track_info("CLIP_RINGTONE", clipId);
// - tracker.trackEvent(VringoConstants.CAT_CLIPS,
// VringoConstants.ACT_PLAY_RINGER,
// String.valueOf(videoClip.getClipId()), 0);
// - tracker.dispatch();
// Library_callHandler.info("Ringer video playback started.");
}