Code Monkey home page Code Monkey logo

Comments (7)

jesusrp98 avatar jesusrp98 commented on July 2, 2024 1

@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.

ma-pe avatar ma-pe commented on July 2, 2024

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.

ryanheise avatar ryanheise commented on July 2, 2024

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.

ryanheise avatar ryanheise commented on July 2, 2024

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.

ryanheise avatar ryanheise commented on July 2, 2024

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.

ryanheise avatar ryanheise commented on July 2, 2024

These features are now released in 0.1.3.

from audio_session.

ryanheise avatar ryanheise commented on July 2, 2024

I'll close this, but if you discover an issue let me know and I'll reopen.

from audio_session.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.