url - Convert byte array to video in android -


i have url , have download video url. application designed in such way can access video data byte array only. getting videoframes last frame recorded.my code given below.anyone please help.

framedata = new byte[mcontentlength];         skipbytes(headerlen);         readfully(framedata);         system.out.println("framedata "+framedata);           string root = environment.getexternalstoragedirectory().tostring();         file mydir = new file(root + "/req_videos");         mydir.mkdirs();         file = new file(mydir, "sample.mp4");          fileoutputstream out = new fileoutputstream(file);         out.write(framedata);         //out.write(framedata, 0, framedata.length);         out.close(); 

well, can convert byte array inputstream, this:

inputstream input = new bytearrayinputstream(yourbytearray); 

then can loop through , output file.

inputstream input = ...; outputstream output = output = new fileoutputstream("yourfilename"); byte data[] = new byte[4096]; int count; while ((count = input.read(data)) != -1) {     output.write(data, 0, count); } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -