Android examples for android.media:Video Uri
convert Video from Uri To Byte array
import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import android.content.Context; import android.net.Uri; public class Main { public static byte[] convertVideoToBytes(Context context, Uri uri) { byte[] videoBytes = null; try {// w w w . j ava 2s . c o m ByteArrayOutputStream baos = new ByteArrayOutputStream(); FileInputStream fis = new FileInputStream(new File(String.valueOf(uri))); byte[] buf = new byte[1024]; int n; while (-1 != (n = fis.read(buf))) baos.write(buf, 0, n); videoBytes = baos.toByteArray(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return videoBytes; } }