有什么问题?
-5001是什么意思?
05-03 15:09:00.766 21171-21183 / com.finnq.masil.dev V / MediaPlayer:收到的消息msg = 100,ext1 = 1,ext2 = -5001 05-03 15:09:00.766 21171-21183 / com.finnq.masil.dev E / MediaPlayer:错误(1,-5001)
public Object instantiateItem(View pager, final int position) {
View v = mInflater.inflate(R.layout.view_guide, null);
v.setTag("video"+position);
final VideoView video = (VideoView) v.findViewById(R.id.guide_item_video);
LinearLayout text1 = (LinearLayout) v.findViewById(R.id.guide_item_text1);
LinearLayout text2 = (LinearLayout) v.findViewById(R.id.guide_item_text2);
LinearLayout text3 = (LinearLayout) v.findViewById(R.id.guide_item_text3);
LinearLayout text4 = (LinearLayout) v.findViewById(R.id.guide_item_text4);
int videoRawData = 0;
if (position == 0) {
videoRawData = R.raw.intro_01;
text1.setVisibility(View.VISIBLE);
} else if (position == 1) {
videoRawData = R.raw.intro_02;
text2.setVisibility(View.VISIBLE);
} else if (position == 2) {
videoRawData = R.raw.intro_03;
text3.setVisibility(View.VISIBLE);
} else if (position == 3) {
videoRawData = R.raw.intro_04;
text4.setVisibility(View.VISIBLE);
}
String uriPath = "android.resource://" + mCtx.getPackageName() + "/" + videoRawData;
video.setVideoURI(Uri.parse(uriPath));
video.setZOrderOnTop(true);
video.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (viewpager.getCurrentItem() != position) {
video.pause();
}
}
}, 100);
}
});
video.start();
((ViewPager) pager).addView(v, 0);
return v;
}