Giter Site home page Giter Site logo

Comments (3)

ryanheise avatar ryanheise commented on July 23, 2024

Hi @volgin

As mentioned in the README, "This plugin can be used with audio_service to play audio in the background". If you missed that, please take a look at that other plugin. But if you already read that but disagree with the vision I had for this project, I would be happy to explain the vision below.

I created just_audio because I needed a plugin that "just" plays audio and doesn't do anything else, including background features. The problem that arises when a plugin does more than one thing is that it starts to step on the toes of what other plugins do, and makes it complicated to mix and match plugins together. The vision is to build an ecosystem of cross-platform audio plugins where you can mix and match the plugins you need, and where there would be, for instance, another separate API for creating a background audio session, that only some apps will choose to depend on.

Background playback is not a requirement of all audio apps, and it involves a whole different set of native APIs, including on iOS, the option to update information in the now playing info, and to respond to controls in the control center, and then on Android, the option to display the current media item in the notification/lock screen, and to respond to controls in those places. I have already run into problems where I could not use two audio plugins together because they were both trying to do certain things in an overlapping responsibility between the two plugins, and thus I decided to institute a separation of concerns and create one plugin for just playing audio (just_audio) and a separate plugin for setting up a background audio session (audio_service). Since it is really the vision for this project, that is unlikely to change.

While it is also tempting to think this is a feature that could be easily added to just_audio (putting aside the fact that it would betray the name of the plugin), this is only the case on iOS, and definitely not the case on Android where background execution is really quite involved, and I do want to create a plugin with consistent behaviour across Android and iOS. And of course, most developers who want to play audio in the background will realise they want more and more features as listed in the previous paragraph, and this will inevitably lead to feature creep, and make the plugin less reusable in different contexts.

from just_audio.

volgin avatar volgin commented on July 23, 2024

Good points. I will try audio_service today.

from just_audio.

github-actions avatar github-actions commented on July 23, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with just_audio.

from just_audio.

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.