我尝试在 ListView 播放视频 .mp4 ,我有一个视频列表,当我单击 play_btn 时会引发错误:
08-02 12:26:42.661: E/MediaPlayer(4593): error (1, -2147483648)
08-02 12:26:43.035: E/MediaPlayer(4593): Error (1,-2147483648)
08-02 12:26:43.035: D/VideoView(4593): Error: 1,-2147483648
这是我的 CustomAdapter 来显示视频列表(.mp4):
public CustomAdapterRecords(Context context,List<HashMap<String, String>> donnees,VideoView video) {
this.datas = donnees;
this.inflater = LayoutInflater.from(context);
this.context =context;
this.video = video;
}
public int getCount() {
// TODO Auto-generated method stub
return datas.size();
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
record=new HashMap<String, String>();
record = datas.get(position);
file=record.get("recordTitle");
LinearLayout rowLayout = null;
if (convertView == null) {
rowLayout = (LinearLayout) LayoutInflater.from(context).inflate(
R.layout.row_item_records, parent, false);
}
else {
rowLayout = (LinearLayout) convertView;
}
TextView title = (TextView) rowLayout.findViewById(R.id.record_titre);
play_btn = (ImageView)rowLayout.findViewById(R.id.play);
stop_btn = (ImageView) rowLayout.findViewById(R.id.stop);
title.setText(record.get("recordTitle"));
play_btn.setOnClickListener(clicPlay);
return rowLayout;
}
public OnClickListener clicPlay= new OnClickListener() {
public void onClick(View v) {
Log.i("nom", record.get("recordTitle"));
Log.i("path", record.get("recordPath"));
video.setVideoURI(Uri.parse(record.get("recordPath")));
if(null!=file){
if(isPlaying==false && isPause==false){
isStop=false;
video.start();
}
else if(isPlaying==true && isPause==false){
isPause=true;
video.pause();
}else if(isPlaying==false && isPause==true){
isPause=false;
video.start();
}
isPlaying=!isPlaying;
}
}};
}
有人知道这个错误吗?