ioscordovaionic-frameworkphonegap-pluginsngcordova

How to access native audio sounds in ios / Cordova?


Are ios native sounds Ringtone, Text Tone, New Mail, etc. available to play directly via Cordova (with the native audio plugin, for instance)?

All the examples I can find require a direct URL to the sound file in your www/audio directory, like this:

//preload the media 
window.plugins.NativeAudio.preloadComplex( 'music', 'audio/music.mp3', 1, 1, 0, function(msg){
}, function(msg){
        console.log( 'error: ' + msg )
});

window.plugins.NativeAudio.loop( 'music' );

Can't they be accessed and played directly? Let's say the iphone has Text Tone preference set to "Aurora." I'd want the app to be able to trigger the "Text Tone," which would play the sound "Aurora".


Solution

  • You can access ringtones now via this plugin: cordova-plugin-native-ringtones.