phoneGap: select audio file from device and upload - android

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

Related

How to embed mp3 files in IOS/Android/WebAssembly with UnoPlatform

I am attempting to build a UnoPlatform app which has the capability to play some embedded mp3 sound effect files.
Using MediaPlayerElement, it is straight-forward to play media from HTTP sources, however it seems there must be some platform specific hoops to jump through to get embedded resource files to play.
The following event handler works for UWP, but not IOS, Android, or WebAssembly:
private void SpinButton_OnClick(object sender, RoutedEventArgs e)
{
player1.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Assets/Sound.mp3"));
}
I have attempted to follow the info here https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/mediaelement for how to embed the media on IOS, but it does not seem to work for me.
Is there a trick to this? is there a sample out there with this working?
The current implementation of the MediaPlayerElement is still a bit limited, but playing back mp3 on Android and iOS should be supported.
The trick is to put the .mp3 files in the right location as they are not yet (as compared to image files) automatically copied over to the correct platform-specific location during build. In case of Android, you need to put the audio files in the Assets folder, for example:
And the Build Action needs to be set to AndroidAsset.
In case of iOS, the files go to the Resources folder and have the Build Action set to Bundle Resource.
You can now reference the files as if they were in fact in the "Assets" folder, using the ms-appx: URI scheme:
<Grid>
<MediaPlayerElement AutoPlay="True" Source="ms-appx:///Assets/test.mp3" />
</Grid>
This is just a quick example, but hopefully you can use it as a starting point. Whenever in doubt, it is quite useful to browse the source code of the respective features on GitHub, for example here is the media file loading implementation for Android.
For WebAssembly, MediaPlayerElement is not supported yet, but if you want to see it supported soon, please vote up on this issue.

How to implement audio streaming app and secure storage in flutter

I am about to build an app like deezer using flutter https://play.google.com/store/apps/details?id=deezer.android.app now for I have 2 question.
Is there any library for online audio streaming which may give the possibility to download the app
How can I store my audio files in a private / hidden folder such as folder created using vault app in case of download https://play.google.com/store/apps/details?id=com.netqin.ps
Thanks for your help
To stream audio you can use this library:
AudioPlayers
To keep your files safe you can use the Sandbox folder in iOS and getExternalFilesDir in Android.
You can find an example of how to implement the saving of the file over here:
Saving data to Local Storage in Flutter
I remind you that SOF is to show what you've done so far, some of your progress, examples, etc so we can help you with that and not how to build an entire app.

Choose which audio file format to use between Android and IOS?

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.

Phonegap Android App - Display Store MP3 Media

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

How to play local video files in a browser

Am looking for the way to play video inside my android browser locally. There may be two or more video's in a local page (like facebook contains video's).
Can anyone please help me out..
Without actually reading about the specifics of the Android built in browser I would safely say, you can't. Well, if you run a local html file it might work, but if you intend to have an external page from which you can play local videos it shouldn't work. I say shouldn't because in the early days of browsers some of them actually did give you access to the local file system. Javascript for example could use file://, something I used myself for image previewing before upload. But this was a major security concern and all modern browsers prevent this.
The difference is if you run a local file or a file on your own local web server. Since then, your local file system is actually part of the web servers file system and the web server can serve your local files.

Categories

Resources