当我想在我的应用上播放视频时,我会遇到奇怪的错误。直到现在视频播放都没问题,但现在我在三星Android手机上出现了这个错误:
02-13 09:35:58.132: I/System.out(4189): Add Video to RelativeLayout
02-13 09:35:58.242: W/MediaPlayer(4189): info/warning (1, 26)
02-13 09:35:58.247: E/MediaPlayer(4189): SISO TEST MEDIA_ERROR
02-13 09:35:58.247: E/MediaPlayer(4189): error (-4, -4)
02-13 09:35:58.287: I/MediaPlayer(4189): Info (1,26)
02-13 09:35:58.287: E/MediaPlayer(4189): Error (-4,-4)
02-13 09:35:58.287: D/VideoView(4189): Error: -4,-4
02-13 09:35:58.287: I/System.out(4189): onError-error play video
和Xperia上的这个错误:
02-13 09:39:26.331: I/System.out(10864): Add Video to RelativeLayout
02-13 09:39:26.381: E/MediaPlayer(10864): error (1, -2147483648)
02-13 09:39:26.401: E/MediaPlayer(10864): Error (1,-2147483648)
02-13 09:39:26.401: D/VideoView(10864): Error: 1,-2147483648
02-13 09:39:26.401: I/System.out(10864): onError-error play video
其中"onError-error play video"
是来自onErrorListener的消息。我从SD卡中删除了视频并重新放入,但我遇到了同样的问题。怎么了?
以下是我将VideoView添加到RelativeLAyout的代码:
public void onAnimationStart(Animation animation) {
myVideoView = new VideoView(getApplicationContext());
myVideoView.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
myVideoView.setVideoURI(Uri.parse(Environment .getExternalStorageDirectory()+ "/BouyguesSlideShow"+ "idPlaylist"+ "/" +vf.getCurrentView().getTag().toString()));
myVideoView.requestFocus();
myVideoView.setOnErrorListener(new OnErrorListener() {
@Override
public boolean onError( MediaPlayer mp, int what,int extra) {
System.out.println("onError-error play video");
return true;
}
});
}
@Override
public void onAnimationEnd(Animation animation) {
System.out.println("Anim end "
+ vf.getDisplayedChild());
if ((vf.getCurrentView().getTag().toString()
.endsWith("Video"))
|| (vf.getCurrentView().getTag().toString()
.endsWith("Video.mp4"))) {
System.out
.println("Add Video to RelativeLayout");
((ViewGroup) vf.getCurrentView())
.addView(myVideoView);
myVideoView.bringToFront();
myVideoView.start();
vf.stopFlipping();
}
}