Playing the Ringtone/Text Tone sounds in Monotouch - ios

In Monotouch for iOS how do I play the system sounds that are used for alarms/messages/ringtones?
Basically I want my app to play the "Old Phone" or "Robot" sound at key points. I don't want to include a .wav or .mp3 in my bundle.

Use MonoTouch.AudioToolbox.SystemSound.PlaySystemSound.
Here is an Apple sample of how to play different system sounds.

Related

is there any way to control system volume from a app in objective c

I downloaded a app named "aurio Touch" from apple for ios platform. It captures the background sound using microphone and plays it simulteniously with other media sound (like, itunes songs, online songs etc). I want to control the capturing sound volume and media sound volume separately. so, Here is my question that is that possible or not. if possible then how can it achieved.
Please help.
Advance Thanks.....

How to export audio as a tones (ringtone) in iOS

Can anybody tell me is this possible to programmatically export audio to tones (ringtone)? Because I want to export custom audio file as ringtone.
Does Apple support this?
That's not allowed in iOS. Still you can done with 3rd party libraries but apple will reject any app that does this kind of behavior. You might be able to save audio so that user can access them if he want can set ringtone manually.
To save audio file Refer:
Record audio and save permanently in iOS

Video player for playing .mpd files

I want to play .mpd files in iPhone app and for that I tried VLC player but it's not working as per expectation and taking too much time to play the video. Is there any other option which i can use to play .mpd files like exoplayer in Android.
I have already implemented VLC media player for this purpose but now I'm looking for another option. Please help if any body have any idea about that.
Google has released a player that can be used with or without their widevine DRM.
https://github.com/google/universal-dash-transmuxer

Custom sound not played when push arrives

I've added a custom sound to my app but it doesn't get played when a push arrives.
I've no idea why not, I can't see anything different from what I have done and there are so few steps involved.
1) The sound file is a valid audio file which is audible (I can even click and play it within Xcode).
2) The sound file is present in the app's bundle:
3) The sound file name is specified with the exact name and case in the push payload:
{"aps":{"alert":"Test","badge":0,"sound":"PyngNotification.caf"}}
4) I've tried specifying the name without the extension, just as "PyngNotification".
5) The push arrives and is displayed but the custom sound isn't played.
6) The phone makes the same noise regardless of if the push content contains a sound of "PyngNotification.caf", "default" or "". Its a short buzz type of sound.
7) Sounds are not disabled on the phone, nor for pushes for the app.
8) The app is registering for UIRemoteNotificationTypeSound (if iOS8). (The app displays Sounds as one of the permitted types if viewed via the control panel).
9) I have more than one phone, one with iOS8, one with iOS7. The sounds plays on neither of them.
10) The sound is under 30 seconds.
11) The sound was ma4 and converted to caf using afconvert.
I can't see any steps I've left out, nor anything that is incorrect.
Anybody have any ideas?
Tap on the sound file that isn't working in Xcode. Look at the file inspector on the right and make sure the "Target Membership" option is checked.
The steps which you provided are pretty much everything I had, except background modes setup. I had to put check on the "Audio, Airplay, and Picture in Picture" mode from the Capabilities > Background Modes. Hope it helps.
Acc. to Apple's Documentation
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW6
Preparing Custom Alert Sounds
For remote notifications in iOS, you can specify a custom sound that iOS plays when it presents a local or remote notification for an app. The sound files must be in the main bundle of the client app.
Custom alert sounds are played by the iOS system-sound facility, so they must be in one of the following audio data formats:
Linear PCM
MA4 (IMA/ADPCM)
µLaw
aLaw
You can package the audio data in an aiff, wav, or caf file. Then, in Xcode, add the sound file to your project as a nonlocalized resource of the app bundle.
You may use the afconvert tool to convert sounds. For example, to convert the 16-bit linear PCM system sound Submarine.aiff to IMA4 audio in a CAF file, use the following command in the Terminal app:
afconvert /System/Library/Sounds/Submarine.aiff ~/Desktop/sub.caf -d
ima4 -f caff -v
You can inspect a sound to determine its data format by opening it in QuickTime Player and choosing Show Movie Inspector from the Movie menu.
Custom sounds must be under 30 seconds when played. If a custom sound is over that limit, the default system sound is played instead.

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