Mam aplikację, która pobiera wideo z kamery lub galerii i konwertuje je na dane base64 i dane są wysyłane na serwer, ale problem jest, gdy tylko konwertuję dane base64, to nie będą poprawne dane w videodacie zmienna. Użyłem do tego poniżej kodu:Jak przekonwertować wideo na dane base64
FileInputStream objFileIS = null;
try
{
System.out.println("file = >>>> <<<<<" + selectedImagePath);
objFileIS = new FileInputStream(selectedImagePath);
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
ByteArrayOutputStream objByteArrayOS = new ByteArrayOutputStream();
byte[] byteBufferString = new byte[1024];
try
{
for (int readNum; (readNum = objFileIS.read(byteBufferString)) != -1;)
{
objByteArrayOS.write(byteBufferString, 0, readNum);
System.out.println("read " + readNum + " bytes,");
}
}
catch (IOException e)
{
e.printStackTrace();
}
videodata = Base64.encodeToString(byteBufferString, Base64.DEFAULT);
Log.d("VideoData**> " , videodata);
proszę zrobić to poprawne ...
Tak jak wspomniałeś mam ten sam błąd co tak OutOfMemoryError będzie rozwiązaniem dla niego? –
Spójrz na to [pytanie] (http://stackoverflow.com/q/11775036/1321873) – Rajesh