Comments (7)
@ryanheise @ma-pe It's not very clear to me how to implement this feature on both iOS and Android.
Could you please share some example code or snippets?
Thanks!
from audio_session.
This would be a great feature that I'd love to see in audio_session.
I personally would like to create a Spotify-alike selection menu of the available audio outputs (speaker, earpiece, connected bluetooth speaker, ...).
This could look something like this:
var outputRoutes = await session.getAvailableOutputRoutes();
// [AudioOutputRoute.Earpiece, AudioOutputRoute.Speaker, AudioOutputRoute.Bluetooth]
// ... show available output routes
session.setOutputRoute(AudioOutputRoute.Earpiece);
There is a plugin with a similar approach: https://github.com/yungzhu/flutter_audio_manager
Unfortunately it is not null safe and there is not possibility to get available outputs.
from audio_session.
The goal is to eventually expose all of the Android AudioManager
and iOS AVAudioSession
APIs, and currently Android is a bit behind. I am trying to at least get the Android side filled out this weekend.
On the iOS side, the API is more complete but actually the parts yet to do are exactly the parts you require. I won't have time to finish that side this week, but if anyone would like to help, pull requests are most welcome. However, from memory some non-trivial decisions needed to be made about how to implement platform method calls on nested objects. I have at least provided some commented-out code in the plugin if someone would like to take a look at it help uncomment/implement the needed parts.
from audio_session.
I've just committed to master
an update to the Android side, adding 35 additional methods to AndroidAudioManager
.
While I won't be able to finish the iOS side this weekend, I can at least take a look at maybe implementing a couple of the relevant methods.
from audio_session.
I've just added some iOS support for audio routes/ports. It is completely untested, but you are welcome to try it and let me know if there's anything I need to fix.
Currently the new functionality is all platform specific code added to the AndroidAudioManager
and AVAudioSession
classes respectively. If there is any common functionality that can be extracted from both of these classes, that can eventually be made available as convenience methods in AudioSession
.
from audio_session.
These features are now released in 0.1.3.
from audio_session.
I'll close this, but if you discover an issue let me know and I'll reopen.
from audio_session.
Related Issues (20)
- AVAudioSession.mm Failed to set category, error: -50 flutter HOT 2
- devicesChangedEventStream returns empty sets on first load HOT 2
- [iOS] Audio session activation failed when app is in background HOT 1
- Support rxdart 0.28
- Is it possible to set preferredIOBufferDuration for `AVAudioSession` HOT 3
- Stop audio when another app plays audio! HOT 1
- How to configure session to use Bluetooth headset mic on Android? HOT 6
- Can't build on android when targetting android 34 HOT 9
- Add privacy manifest for Apple HOT 6
- [iOS] Background audio not playing on iPhone 13+ HOT 3
- AVAudioSessionCategoryOptions.mixWithOthers stops background music the first time when audio is player, after continuing the music further sounds no longer stop the music HOT 1
- Call requires API level 23 (current min is 16) HOT 1
- Can not play by speaker on iOS HOT 3
- Is it possible to play audio when Do Not Disturb mode is on, but not in silent mode? HOT 1
- `AVAudioSessionCategoryOptions`'s `contains` method takes `AVAudioSessionInterruptionOptions`. Maybe it should be `AVAudioSessionCategoryOptions`? HOT 5
- Dependency causing an ANR in the Background HOT 3
- The music played by IOS17 is not output from Bluetooth earphones HOT 2
- Android detects the headset as if it is connected even if it is not HOT 1
- Trouble closing an audio session HOT 1
- Topics HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audio_session.