Android VideoView playback issues on recorded files -
the problem have trying program playback .amr file has been recorded using default android voice recorder. have downloaded mp3 voice recorder , tried playback on doesn't work either. have downloaded .amr , .mp3 files work it's ones recorded don't seem work.
code dump:
private static final string recording = new string(environment.getexternalstoragedirectory().getpath()) + file.separatorchar + "my documents" + file.separatorchar + "my recordings"; arraylist<string> songlist = new arraylist<string>(); private listview playlist; private videoview videoview; private mediacontroller mediacontroller; private void loadplaylist() { songlist.clear(); file home = new file(recording); if (home.listfiles( new amrfilter()).length > 0) { (file file : home.listfiles(new amrfilter())) { songlist.add(file.getname()); } } if (home.listfiles( new mp3filter()).length > 0) { (file file : home.listfiles(new mp3filter())) { songlist.add(file.getname()); } } arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, songlist); playlist.setadapter(adapter); } class amrfilter implements filenamefilter { public boolean accept(file dir, string name) { // todo auto-generated method stub return (name.endswith(".amr")); } } private void refreshplaylist() { songlist.clear(); file home = new file(sd_path); if (home.listfiles( new mp3filter()).length > 0) { (file file : home.listfiles(new mp3filter())) { songlist.add(file.getname()); } } arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, songlist); playlist.setadapter(adapter); } private void playfile(string currentfile) throws illegalargumentexception, securityexception, illegalstateexception, ioexception { videoview.setvideopath(currentfile); videoview.start(); playbtn.setvisibility(view.visible); // set progress max videoview.setonpreparedlistener(new mediaplayer.onpreparedlistener() { @override public void onprepared(mediaplayer mp) { playbar.setmax(videoview.getduration()); startseekbar.setmax(videoview.getduration()); startseekbar.setprogress(videoview.getcurrentposition()); stopseekbar.setmax(videoview.getduration()); stopseekbar.setprogress(videoview.getduration()); int msec = videoview.getduration(); int time[] = secondstominutes(msec); totalplaytime.settext(time[0] + ":" + time[1] + ":" + time[2]); } }); handler.postdelayed(runner, 1000); }
the logcat error is:
07-01 05:51:45.363: e/mediaplayer(2912): error (1, -2147483648) 07-01 05:51:45.383: e/mediaplayer(2912): error (1,-2147483648) 07-01 05:51:45.383: d/videoview(2912): error: 1,-2147483648
i'm not sure problem restricted ones record. don't think it's file permissions android mp3 player can play mp3 recording.
<uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.read_external_storage" /> <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.jahed.medialooper.mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application>
playing sound file in video view not great idea. videoview play video files can play .mp4 .3gp ease
try using mediaplayer
Comments
Post a Comment