0

I have an Android app that takes videos and saves them to a Firebase database. It stores the videos as encoded strings using Guava:

String encodedVideo = Files.toString(videoFile, Charsets.ISO_8859_1);

I am also developing a companion web app using AngularJS that should allow users to download the videos (by clicking a link) that have been stored to the database. However, I cannot use Guava to decode the string since it's not available for Javascript.

I am very new to AngularJS and web development in general. I'm sorry if this is an ignorant question, but what would be the simplest way to decode the string and create a downloadable file?

Amyga17
  • 199
  • 11
  • 1
    It looks like you're taking each byte of the video file and storing it as a 2-byte character in memory, with the upper byte always 0. Seems like a waste of memory. Can you just read into a byte array? Or better yet stream bytes out as you read them from the file, so that you don't risk running out of memory for a large video? – Hank D Apr 25 '16 at 01:36
  • 1
    See http://stackoverflow.com/questions/1053467/how-do-i-save-a-string-to-a-text-file-using-java for some pointers on writing the String back out to a text file, and http://stackoverflow.com/questions/10100936/file-downloading-in-restful-web-services for how to make a file download web sevice – Hank D Apr 25 '16 at 01:44

0 Answers0