Android: SequenceInputStream Merging two mp3 not working -
am trying merge 2 mp3 file using sequenceinputstream, in final result app getting first mp3. both file path given external storage , mp3. not understanding why final result contains first mp3 path given.
here code
private void mergesongs(file mergedfile,list<file> filestomerge){ fileinputstream fistofinal = null; fileoutputstream fos = null; try { fos = new fileoutputstream(mergedfile,true); fistofinal = new fileinputstream(mergedfile); for(file mp3file:filestomerge){ if(!mp3file.exists()) { continue; } fileinputstream fissong = new fileinputstream(mp3file); sequenceinputstream sis = new sequenceinputstream(fistofinal, fissong); byte[] buf = new byte[1024 * 2]; try { int x = 0; while ((x = sis.read(buf)) != -1) { fos.write(buf, 0, x); } } { } } } catch (ioexception e) { e.printstacktrace(); }finally{ try { if(fos!=null){ fos.flush(); fos.close(); } if(fistofinal!=null) fistofinal.close(); } catch (ioexception e) { e.printstacktrace(); } } is there way merge/ concatenate mp3 songs sequentially.
Comments
Post a Comment