Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio low after using camera #162

Open
swissdude opened this issue May 26, 2021 · 3 comments
Open

Audio low after using camera #162

swissdude opened this issue May 26, 2021 · 3 comments

Comments

@swissdude
Copy link

swissdude commented May 26, 2021

I don't know whether this is really related to this plugin, but here's what I observed.

I have an app with a text2speech function.
The camera is loaded into a modal view.

After opening and closing the camera, the text2speech is only half as loud as before. Setting the volume doesn't do anything.

Is the plugin fiddling with the volume settings? How can I avoid this?

The effect only shows on iOS - Android's working fine.

@swissdude
Copy link
Author

I still don't know what the cause of the problem is, but if anyone runs into that, I just added

AVAudioSession.sharedInstance().setCategoryWithOptionsError( AVAudioSessionCategoryPlayAndRecord, AVAudioSessionCategoryOptions.DefaultToSpeaker);

before every audio-related task in the app. That seems to reset the volume.

The problem applies to videos that are played as well, btw. So after showing the camera-preview to the user, the volume of all other sounds is dropped to like 10%.

@Bezlepkin
Copy link

I still don't know what the cause of the problem is, but if anyone runs into that, I just added

AVAudioSession.sharedInstance().setCategoryWithOptionsError( AVAudioSessionCategoryPlayAndRecord, AVAudioSessionCategoryOptions.DefaultToSpeaker);

before every audio-related task in the app. That seems to reset the volume.

The problem applies to videos that are played as well, btw. So after showing the camera-preview to the user, the volume of all other sounds is dropped to like 10%.

Hi! Have you solved this problem?

@update-switzerland
Copy link

@Bezlepkin Didn't really solve it - just what I wrote above your comment. Add AVAudioSession.sharedInstance().setCategoryWithOptionsError( AVAudioSessionCategoryPlayAndRecord, AVAudioSessionCategoryOptions.DefaultToSpeaker); to every Audio related task. That should reset the volume.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants