Reputation: 293
I try to play a video .mp4 in ListView , I have a list of videos, and when I click play_btn it throws errors :
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
this is my CustomAdapter to show list of videos (.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;
}
}};
}
Anyone have an idea about this error?
Upvotes: 0
Views: 706
Reputation: 372
There are multiple problems when video is not played according to error code.
try to play the file using default media player in android. if it is plays no issue with video.
if video in phone memory move the file to sdcard and play the video from there.
Happy to help.
Upvotes: 1