In my app,I want to make sure user can record his sound and sent to other user to listen to it.
In android platform I choose .amr ,it's not too big and easy to record.
Then I realized I should make sure my ios user can chat with my android user,but .amr seems not support in ios(after v4.3).
So is there a certain audio file format that can use between android and ios platform?
Or I have to let my Server to do the Transcoding job?
Both android and iOS should be able to handle mp3 files.
You can encode to mp3 on the device using various open source projects (could be a combination of steps).
I would personally go for a server-side encoding/conversion, because too many things can go wrong (especially on all the various Android versions and devices)
At last we use amr. Ios client do the decode job.
Related
I'm new to react native and I'm trying to code a POC where I use the text-to-speech feature from Watson-IBM.
This service, from IBM, has an HTTP REST interface that I provide the text and it returns to me the .wav (for example) file with the audio of that text.
So, in a way, I have the "audio" saved in a variable.
Now I need to play this audio.
I've looked for some libraries that would play this audio. However, most of them need a "real file", with a path, to be able to play the audio.
However, in my case, I do not have a "real file" (by "real file", I mean a file in the folder of the project, for example). I have only a variable with this information.
I could save this variable to a file and then read from this file, but I am not sure if this is the best way to go.
So, can anyone suggest to me a library (or a better approach) to play this audio that came from Watson text-to-speech in my react native app?
(I need it to work only on Android. No need for iOS support.)
Thank you in advance.
You could use react-native-audio-toolkit for playing network resources.
For Watson API Authentication, you could get authentication token then use it via watson-token query parameter.
import { Player } from 'react-native-audio-toolkit';
new Player('https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?watson-token=TOKEN').play();
Watson API Doc: https://www.ibm.com/watson/developercloud/text-to-speech/api/v1/
I'm serving an audio file (WAV file that contains a short uncompressed PCM) from my GAE app using BlobStore.
On a click event, I set audio.src and call audio.play().
Now here is the weird part:
When working locally - it plays well on both IOS and Android.
After deploying to GAE, it plays well on IOS - but not on Android!
No error is shown - it just plays nothing.
As far as I can tell from GAE logs, the audio file is served in all cases.
In case of Android I can see a requests from "Player/LG Player 1.0 for Android 4.4.2 (stagefright alternative)".
Any idea what's going on, or how to debug this?
Update
Tried playing files from Google Cloud Storage, according to Stuart Langley's suggestion.
In that case, Android plays well, and IOS doesn't (intermittently. Sometimes gives an error).
So a workaround that works for me is storing the file on Cloud Storage, and also calling createGsBlobKey in order to serve it as a blob.
On the client side I check whether it's Android (navigator.userAgent.match(/Android/i)). In case of Android I set audio.src to the Cloud Storage file, and in case of IOS I set it to my servlet which serves the file using BlobstoreService.serve with the blob key I got from createGsBlobKey.
This is a cumbersome workaround and I didn't check other mobile OSs to see what works for each, so if anyone has a better solution please let me know.
Most likely this is due to the chunked response when serving a blob.
Here is an issue tracker item about audio files not playing correctly in some browsers.
Here is a test web site I put together while back that illustrates the problem.
As for workarounds - You can put the file on cloud storage and then play it from there, as long as you're not concerned about people hotlinking the file.
I am trying to create an app that can play/create/modify a midi file but the standard instruments are not complete. I have the sf2 files. Can someone guide me where i can look for what i need build this app please. Is fluidsynth is the best option?
I am new to phoneGap. I am creating a dummy app to upload an audio file from iOS/android device on local server. So I was wondering if there is a way to open the audio gallery and select the required audio file to upload. Similar to an image gallery.
Is it possible to open audio list and select necessary audio file? If not, what is the alternative?
As far as I remember, you cannot reach the pictures and audio files stored in the media gallery. Therefore, you may need to implement your own native plugin and call the appropriate methods from your JavaScript code.
You can capture audio/image by using Capture plugin of Phonegap. Check this out Capture Plugin
You can perform basic File operations as well. Check this out File Plugin
For your situation, you have to implement native interface which can be accessed by your JavaScript code. This would be an alternative way for it. If you desire to create your own plugin, please have a look at Plugin Development Guide. This might be helpful.
Well I have implemented code using file plugin which will iterate through all the folders recursively to find all the image (created this as I needed multi selection approach which is not directly provided by cordova) . You can modify the extension of image (search) i.e png,jpeg etc with audio extension.
With this code you will get the path of audio files and you can make use of filetransfer to upload it on server
Hope it helps you
I've been following this blog to help me make a simple music player function with an Android app (http://simonmacdonald.blogspot.com/2011/05/using-media-class-in-phonegap.html).
All works well - but I would like some way to extract a list of all music media stored on the phone so the user can click a file and play it. Does anyone know if this is possible via phone gap? I'd need to access track name/artist etc and a link to the track.
Cheers
Paul
Prognosis is not good.... PhoneGap does not have an API for accessing the media library. So, you would have to fall back to the File API to locate music files, and then... you would have to read the binary data in the actual files to extract out the track/artist metadata. Ouch. Seems pretty impractical.
[EDIT]
By the way, PhoneGap is not the only game in town. Appcelerator seems to solve the same problem, and apparently has a richer API, which includes
access to media metadata