I am new to IBM Worklight. I want to create an application that record the voice on mobile device, upload the audio file to HTTP adapter, then covert the audio to .flac and send it to google server for analysis. I couldn't find any information on uploading files to HTTP adapter, can someone point me to the right direction?
Please find my application architecture in the attachment.
This topic has been locked.
4 replies Latest Post - 2012-11-23T18:21:33Z by SystemAdmin
Re: How to upload audio file using an HTTP adapter2012-11-14T05:30:29Z in response to SystemAdminCan you share a link to Google's Voice Recognition Service public API? What have you tried so far?
I don't think you can send files to Worklight Adapters. You can however just record the audio, base64 encode it, send it to the adapter that way and have the server base64 decode it to play it.
You can also try Apache Cordova's File API (it's already built-in into Worklight):
"The FileTransfer object provides a way to upload files to a remote server using an HTTP multi-part POST request."
Re: How to upload audio file using an HTTP adapter2012-11-21T04:28:29Z in response to SystemAdminHi cnandreu,
Thank you for your reply. I created a simple web app that is hosted on tomcat. The web app is able to send audio file to google voice server and get back with recognized words. Here is the tutorial on how to do it. http://www.smartjava.org/content/record-audio-using-webrtc-chrome-and-speech-recognition-websockets
Now I want to send my audio file from android to my tomcat server via Worklight adapter. I'm interested in your solution on encoding the file to base64. But I can't find any worklight APIs or library that can encode it. Can you point me to a right direction?
IdanAdar 2700059KWB741 PostsACCEPTED ANSWER
Re: How to upload audio file using an HTTP adapter2012-11-21T05:24:36Z in response to SystemAdminThere is no Worklight API to do so. It is common practice.
There are numerous resources on the web on how to achieve this encoding.
Here is one from StackOverflow, perhaps it will be of assistance: http://stackoverflow.com/questions/6448865/base64-encode-audio-file-and-send-as-a-string-then-decode-the-string
IBM Worklight Mobile Platform