Is possible to save recorder audio file in musics in swift? - ios

Hi in my app I have one feature to record audio and save it application directory. Client asking me is it possible to save audio file in musics?. That is client need to play recorded audio file without our application. I searched lot but cant find solution

No all iOS applications are sandboxed and the app data generated by the app cannot be used by other apps and can't to saved into other apps. The only way to share data between apps is through UIActivityViewController and it unfortunately does not provide any way of opening a file in music app. It is possible for jailbroken devices however.

Related

Save audio file to a user-friendly location swift 3 avfoundation

I am writing a simple recorder application which can record/play audio (via. AVFoundation) and save it locally to the iOS device. I've found several sources de
Initially, I would have liked to send out multiple of these saved audio files via email (MessageUI) such as with this simple example: https://gist.github.com/kellyegan/49e3e11fe68b5e6b5360 - though recently I have felt maybe I should forego this in favor of simply saving to the device and allowing the user to send out the file somehow.
Considering this, I feel it might be best to try to save the audio file to a more user-friendly destination. Is there any way I can save these files locally that might allow the user to 'share' them via iOS (outside of my application)? Maybe even to their iTunes library? This seemed promising: iOS - Save audio files to iTunes music library - but looks like the solution provided is actually for saving images to the 'photo album'
When I print the audio file's URL I get something like
'file:///var/mobile/Containers/Data/Application/AA3E5177-A8C8-4FFA-8EBC-85A2A6844A88/Documents/recording-2017-03-06-12-54.m4a'
I am a serious noob w/ Swift 3 and definitely with AVFoundation - I'd really appreciate any and all help/advice. Thanks in advance!
The URL 'file:///var/mobile/Containers/Data/Application/AA3E5177-A8C8-4FFA-8EBC-85A2A6844A88/Documents/recording-2017-03-06-12-54.m4a' may look elaborate to you, but in fact it is totally "user-friendly". It's a file in the app's Documents folder! Nothing could be simpler than that.
The URL in question would never be seen by the user; in fact, it won't even be the same between runs of your app.
Your app can certainly provide interface for the user to select one or more files, and can make them available for sharing out by means of UIActivityViewController or UIDocumentInteractionController.
You might also want to look into UIDocumentPickerViewController or even https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/FileProvider.html
iOS apps are heavily sandboxed. The app's Documents directory (at the path you posted) is the typical place for files like this. You can enable file sharing from the app in iTunes (on the user's computer) by adding the UIFileSharingEnabled key (Application supports iTunes file sharing) to your Info.plist file.
The typical way to enable sharing within the app is by using UIDocumentInteractionController or UIActivityViewController.

IOS - Storing Audio and Videos outside App Sandbox

I am fairly new to IOS App Development. I have an app which plays audio and videos that are present in the App Package. Now I want my app to play audios and videos that are outside the App Package altogether i.e. if I uninstall my app the media files should not be deleted.
I have heard that all the apps can access media files that are added through ITunes. So I want to know the path of this folder(Kindly excuse me if you find my terminology vague. As I said I am fairly new to IOS App Development).
You cannot store the files outside app sandbox. Where as we can save image/video files to photos app
using, UIImageWriteToSavedPhotosAlbum/UISaveVideoAtPathToSavedPhotosAlbum
Please check developer documentation

How to export downloaded audio file(from within app folder) to user accessible music folder in IOS

I am using Xamarin to develop an IOS app. Here the user has an option to download audio files to the document folder within the app, and play it later on.
But i would like to provide an option for the user to access it in music folder or somewhere else, so that user does not have to come back to app to listen it.
Like we save images to camera roll, can we save mp3 or any other audio file to default music folder in IOS. Any solution or ideas using xamarin or xcode are welcome.
Note: I already know about File Sharing with itunes, i am looking for something else explained above.
As I know this isn't possible due to the limitations within iOS

How to save the generated tone to the audio file in iOS?

I have read the tone generator in ios from http://www.eslacker.com/?p=198. After that, I want to improve it to can save the tone generator to the audio file. So , the tone generator can be ringtone. How can I got it? Thanks before :D
You could possibly have it upload the file as simple PCM to your website for conversion, allow the user to download it to his/her computer, and tell them how to sync it, but there is not a chance in hell apple would make it easy to make ringtones with only an iphone. After all, they make money by only letting you easily make ringtones from songs you buy on iTunes, but won't let you use ones ripped from CDs without lots of workarounds. You can do it from a desktop by cropping the sound to 30 seconds, converting it to AAC, and giving it the file extension .m4r, and then importing it into itunes and syncing. I have no idea how to do it without a jailbroken iDevice that can access the root filesystem and change the .plist files and database files that control synced media. You could run ffmpeg on a webserver and use that to make and crop ringtones. Or port and include ffmpeg inside your app and have it convert it and save it in the space that you can share between apps and manage with itunes.

Add Music to iOS programmatically

Let say I want to create an iOS app that download music files from the internet.
Is it possible then to put this music files on the Music Library so that I can play it?
It's not possible. The only way to add music to your library is through iTunes or through the iTunes Store app. Even if you did find a way, it'd probably be through some private API and you'd probably get rejected on the app store.
As Simon said, you won't get music into the native music library. You could however store the audio files and use the AVFoundation Framework (AVAudioPlayer class) to replay them. You could also possibbly use the AudioToolbox framework. Problem is you would have to implement your own music library and your own playback functionality.
Did I mention you have roughly a 0% chance of this app making it into the app store?
It is clearly possible though...even trivial...
Well, in terms of possibility, it is possible if you jailbreak your device, you'd need 2 tweaks to do it:
"Safari download enabler" or manager: to allow you to download files.
"Bride": allows you to import downloaded or saved mp3 files or mp4 video files to your iOS library.
I've been using it for a while and it works like magic
You can have private API/Library. Though I never tried, but you can.
Here is the another similar post:
Programmatically add content to music library

Resources