ryanheise / audio_session

MIT License
115 stars 81 forks source link

Make sure outputs are not missed in getDevices #79

Closed tjarvstrand closed 1 year ago

tjarvstrand commented 1 year ago

Currently, getDevices returns headsets as being input only on iOS.

The device is currently added to the devices Set as an input-only. Then, since AudioDevices compare equal if their ID is the same (which probably should not be changed willy nilly) the add is ignored when trying to add the same device as an output as well.

ryanheise commented 1 year ago

I've pushed a change which ensures outputPorts: is included on all invocations of _darwinPort2device so that equality by id should actually be correct.

Hopefully this resolves your issue, although please let me know if it doesn't.

ryanheise commented 1 year ago

Closing as resolved, but happy to re-open if you report the problem persists.

tjarvstrand commented 1 year ago

Hey! Unfortunately we ended up not using this library so I can't verify. We needed to integrate with other platform libraries that also affect audio so it was sadly easier to just roll our own.

Thanks for looking into it though!

ryanheise commented 1 year ago

No worries, thanks for making me aware of the issue.

Hopefully others (or maybe myself if no-one else does it) will create plugins for the other missing platform libraries in a way that promotes interoperability at the Dart level, and this is expected to become easier with FFIgen and JNIgen. When JNIgen stabilises, I'll start by switching this plugin over, and then expand the API surface area to include the Android media router API.