3
votes

I'm uploading a .mp4 file recorded in an cordova-based android app to a server, and I'd like users to be able to play it. Mediainfo indicates it's AMR (adaptive multi-rate, with quicktime codec type "samr"). I've tried a variety of mime types for playback in chrome, but the only one that gets close is audio/mp4: for that mime type, chrome will open a player, but indicates it's permanently muted, and won't play any audio. For mime types audio/amr and audio/amr-nb, chrome downloads the file instead of playing it. Mplayer plays the file ok, so I know it's not corrupt.

If I convert it to mp3 at the server using "avconv -i src.mp4 dest.mp3" and change the mime type to audio/mpeg, then chrome plays it correctly. But I'd prefer not to use a lot of server cycles to do that.

Is there a provision in cordova to change encoding from amr to mp3? If not, is there a way to get chroma (and firefox) to play an amr mp4 file?

1
I ended up saving the mime type (audio/amr) with the file and providing it in the header. Chrome then recognized that it couldn't play the file and automatically downloaded it. However, even without the mime type, the stbl/stsd format for the audio track in the mp4 file is "samr", which should let chrome know it can't play it. And I find it very odd that google would choose a default mime type for android that it's own browser can't handle.MgFrobozz

1 Answers

0
votes

You have an option to convert the file using the cloud convert api.This api can be used for converting video, audio and image files.There is a node package for implementing the same.You can use cordova-plugin-file-transfer for handling with the files.