Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send video files as json data. (Not the file name or path but content) to Android

I'm using a restful webservice developed in php. The webservice will send data images. For images it will send the image name and we will prepare the url of the image on fly to download it. But now there is a requirement to download video files. We can follow the same way like downloading images (ex: image name = "myimage1.jpeg" url=www.xyz.com/images/myimage1.jpeg", we will read this directly and create file locally), but want to know is there any way from php to send the data like binary string from php and convert it into movie file at Android end.

(Can we send images as json data from php webservice. Please give some code)

Note: How to send Images/Videos files from restful webservice as json data

like image 445
kumar Avatar asked Jan 16 '14 17:01

kumar


1 Answers

As ChriZzZ stated, it's inadvisable (and not really natively supported) in JSON.

However, you may consider using BSON (Binary JSON). Specifically for a PHP implementation, the site provides a link to Mongo, so you may want to check that out. Unfortunately, I have no code to provide.

like image 146
iamchris Avatar answered Nov 01 '22 06:11

iamchris