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

Calls result in PlatformExceptions #46

Open
melio-matt opened this issue May 9, 2023 · 5 comments
Open

Calls result in PlatformExceptions #46

melio-matt opened this issue May 9, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@melio-matt
Copy link

I'm running my Flutter app on a MacOS Ventura 13.3.1 and calling all of the APIs results in errors of the following code. I'm running my app off the command line 'flutter run -d macos'. I've read the readme files and not see there any permissions to set or initialisation procedure that I must do and I'm just copying the examples.

PlatformException(1004, Failed to register volume listener, The operation couldn’t be completed. (flutter_volume_controller.Sound.SoundOutputManager.Errors error 1.), null)

PlatformException(1000, Failed to get volume, The operation couldn’t be completed. (flutter_volume_controller.Sound.SoundOutputManager.Errors error 1.), null)

I've done a flutter clean and rebuild but that didn't change anything. A Google search did not yield any results, hence my post here as I don't currently see what else to try as the API is pretty straight forward.

@yosemiteyss
Copy link
Owner

Hi, can you provide more context? Like what sound output device you have selected?

@melio-matt
Copy link
Author

Hi
From your comment output device does seem to be critical here. When I was trying this I had my MacBook connected to my monitor via USB-C and the sound was being outputted by my monitor to some speakers. In this configuration I get the exception. When disconnecting my MacBook and using its internal speakers everything worked fine. I do have noted that when my machine is connected to the monitor the normal Mac sound controls are disabled.
Is there a good way to detect first whether sound control is present (rather than catching exceptions) and also a good way to detect the change in sound output device? One of the things I'm trying to do is listen for changes in volume so would need to register and unregister when sound output device allows.
thanks

@yosemiteyss
Copy link
Owner

It seems your monitor doesn't support volume control. Right now the plugin can only access the default audio output device. If you want to control another audio device, like switching from monitor to macbook speaker, you have to do it from OS settings.

A better approach would be controlling a specific output device through its device id. But it would take some times to implement on different desktop platforms.

@melio-matt
Copy link
Author

I wasn't looking to control the output device only react to it changing and knowing its capabilities. Currently I only know there is no volume control when I ask for the current volume and an exception is thrown. It would be nicer if calling getVolume reported it wasn't available rather than getting an exception and I would then know not to register the volume listeners. Having a listener to know when the output device changes would be nice, but I could poll getVolume, handle the exception, and use this as my mechanism.

@melio-matt
Copy link
Author

One thing that would be good would be to mention this on the readme page, could save someone else some time in wondering why it isn't working for them. Thanks

@yosemiteyss yosemiteyss added the enhancement New feature or request label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants