Can't play recorded wav file from Android on iOS, Cordova

145 views
Skip to first unread message

Thomas Tveten

unread,
Mar 3, 2014, 8:16:48 PM3/3/14
to phon...@googlegroups.com

Something strange with Audio recording... Im building an application using cordova, and using the media object to record the audio for both Android and iOS. I record the media file as a .wav file (recording.wav) for both platforms. When Im finished with the recording, I retrieve the base64 encoded string with the file system and readDataUrl (base= evt.target.result). The base64 encoded string looks good for both devices, its just one big difference and that is ios have a much larger base64encoded string than Android.

I play the recorded media to be sure that everything is good, which it is and upload the base64 encoded string to parse.com as a file. Before I upload it, I remove the first letters in the base64 which is on Android: data:audio/x-wav;base64, and on iOS: data:audio/wav;base64, . When I try to play the sound I recorded on android, on a android device it works perfectly. The same for iphone, When I try to play the sound I recorded on Iphone on a android device, every thing works fine. However, when I try to play the sound I recorded on the android phone on a iphone, it does not work!

I try to play the media file in parse.com, and on iOS it works fine, but on Android it looks empty.. and I cannot play it from the web, just on a android phone using my application and retrieving the url from parse.com.

I play the media file just by retrieving the url from the file object from parse.com. I guess this is something due to the fact that android record the wav file on a different way? If I look on the base64 from the wav file in android, it is as I mentioned much smaller, and complete random characters. However, on iOS its a LOT of "A"s in the beginning of the base64 string. Am I suppose to add lots of A's to the base64 before I send it up as a file to parse.com?

Please help if you have any knowledge of this.

Reply all
Reply to author
Forward
0 new messages