Create a copy of video (.mp4) file android -


i copy existing video file video file.

i trying this:

    byte c;     try {         fileoutputstream newfile = new fileoutputstream (video_path_tmp);         fileinputstream oldfile = new fileinputstream (video_path);         while ((c = (byte) oldfile.read()) != -1) {             newfile.write(c);         }          newfile.close();         oldfile.close();     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     } 

but doesn't work. output file created, can't see video.

how can implement this?

thanks!

ok, found answer , code:

 try {          fileoutputstream newfile = new fileoutputstream (video_path_tmp);         fileinputstream oldfile = new fileinputstream (video_path);           // transfer bytes in out         byte[] buf = new byte[1024];         int len;         while ((len = oldfile.read(buf)) > 0) {             newfile.write(buf, 0, len);         }         newfile.close();         oldfile.close();     } catch (ioexception e) {         // todo auto-generated catch block         e.printstacktrace();     } 

i added buffer array , solved problem :)


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -