Software Archive
Read-only legacy content
17061 Discussions

Audio plugin without permission to use microphone?

Florian_D_
Beginner
984 Views

Hi,

currently im suing the "Media" plugin for playing sounds in my game but that plugin also wants permission to use the microphone. My doesnt need the microphone and i dont want people to think that these games are some kind of spyware, so is there a sound plugin that doesnt need microphone access? Or could you add a media plugin without thispermission?

Thanks!

best regards

Florian

 

0 Kudos
2 Replies
PaulF_IntelCorp
Employee
984 Views

You might give this one a try (https://github.com/SidneyS/cordova-plugin-nativeaudio), or search for some others by looking for "Corova plugins audio" (or similar searches). The one I'm referencing is based on some code from some good authors, so I suspect it is a good place to start (I have not used it, so I cannot say for sure).

Also, you can always clone an existing plugin, such as the standard Cordova Media plugin, and change its permissions by modifying the plugins.xml file. You'll then have to include it as a local third-party plugin. You might want to give it a unique plugin ID, as well. For example, in the media plugin.xml file you'll find this:

        <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.RECORD_AUDIO" />
            <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
            <uses-permission android:name="android.permission.READ_PHONE_STATE" />
        </config-file>

And in that other one I found, you'll find this:

        <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
            <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
        </config-file>

So that other one does not require the record permission, but the first could be made to do the same. As long as you don't call the record APIs you'll be okay; if you do call them, without the permission set, you'll get an error back in your call.

0 Kudos
Florian_D_
Beginner
984 Views

wow, thats cool! Thank you very much, i will try this :)

0 Kudos
Reply