You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HELP] - Unable to Start recording due to not getting permissions #9
I keep getting this error when trying to start recording: Unhandled Exception: PlatformException(SoundRecorder, Permissions, Error setting the AudioSource. Check that you have permission to use the microphone.)
I've checked in the the _initializeAndRun() portion of the record method and it looks like its succeeding as hasPermissions is true, but then I get this error return and the recording does not begin. I haven't been able to figure out where this is sending from or what is triggering this (or how to get this to trigger and ask for permissions). I have added the necessary permissions to the AndroidManifest files.
I was able to get this work my pulling in the permission_handler package and before calling the record method using that package to check for and ask for permissions for the microphone. I'm also not sure if this is intended or if there is a way to make this automatic. I'm willing to take a look (since this seems like it could be handled with pure dart) and try to implement this.
Updated documentation seems to cover it! Thank you! Is there any sense in having sounds handle it if the user hasn't yet (just check whether they have an undetermined status and prompt if so when we start the recorder)? Or do we (you mostly, since I'm no expert haha) think this will cause problems/not worth it?
the dev needs control over when the request is made.
minimize the no. of included packages to avoid Sounds being a source of dll hell. (e.g. they may need permissions in other parts of their app and they may need a specific version of a permission library).
So the approach I took was to provide the callback, so they can do it as late as possible and to then provide examples of how to do it.
Activity
kbanta11 commentedon Jun 18, 2020
I was able to get this work my pulling in the
permission_handlerpackage and before calling therecordmethod using that package to check for and ask for permissions for the microphone. I'm also not sure if this is intended or if there is a way to make this automatic. I'm willing to take a look (since this seems like it could be handled with pure dart) and try to implement this.bsutton commentedon Jun 18, 2020
Have a look at this doco:
https://github.com/bsutton/sounds/wiki/SoundRecorder
Look for the section on permissions.
The intent is that you get the permission first. This gives you control over when the user interaction occurs.
kbanta11 commentedon Jun 18, 2020
Updated documentation seems to cover it! Thank you! Is there any sense in having sounds handle it if the user hasn't yet (just check whether they have an undetermined status and prompt if so when we start the recorder)? Or do we (you mostly, since I'm no expert haha) think this will cause problems/not worth it?
bsutton commentedon Jun 18, 2020
My logic was two fold.
So the approach I took was to provide the callback, so they can do it as late as possible and to then provide examples of how to do it.