just_audio icon indicating copy to clipboard operation
just_audio copied to clipboard

Lock Screen controls customisation from just_audio

Open nzackoya opened this issue 2 years ago • 7 comments

Is your feature request related to a problem? Please describe. I have a task to remove the seek bar when there is a short audio in a loop. Also manually fake duration setting that affects the seek bar would be great, because I have a task to make the seek bar to match the set timer.

Describe the solution you'd like I would like to have just a function that simply removes the seek bar. Also to be able to set a fake duration that impacts the seek bar, no matter how long is the duration of the media(e.g. if the duration is not set, then the duration is the input media's duration, else the one that was set manually in the MediaItem).

Describe alternatives you've considered In the audio_service there is the thing that I described above, but I don't want to reinvent the wheel, just use just_audio and have ability to customise.

Additional context N/A

nzackoya avatar Mar 05 '22 20:03 nzackoya

In the audio_service there is the thing that I described above, but I don't want to reinvent the wheel, just use just_audio and have ability to customise.

I assume you mean just_audio_background.

I can understand that you want just_audio_background to have more convenience methods for each use case, however, there's a huge number of possible use cases, and implementing them all would not be practical. So a use case would need to be in extremely high demand before I'd implement it based on all the API feedback from the different users. That is why I would suggest audio_service if you have more advanced requirements.

ryanheise avatar Mar 06 '22 01:03 ryanheise

Is there at least a way to hide/show the seekbar dynamically without rewriting almost whole app?

nzackoya avatar Mar 08 '22 12:03 nzackoya

I can't comment on how much of your app would need to be rewritten, I can only comment that you have more advanced requirements than are supported by just_audio_background and therefore you should use audio_service directly as advised in the README. I would suggest starting on that approach since this feature request will almost certainly not be decided on in time for your release.

ryanheise avatar Mar 08 '22 13:03 ryanheise

I understand that, but I can't find a way to pass values to playbackState from current player or anywhere else. Should I rewrite just_audio_background to be able to pass a custom audioHandler, to be able to broadcastState with new controls? I just can't find detailed docs. Please guide me to achieve this. I believe there should be an easier and right way of doing this

nzackoya avatar Mar 08 '22 14:03 nzackoya

If the audio_service documentation is not detailed enough, please open a documentation request on that plugin since it is a separate plugin from just_audio, or to search the audio_service questions on StackOverflow (although I think the documentation, tutorials and examples for that plugin are plenty.) I can't offer you advice other than to learn how to use audio_service.

ryanheise avatar Mar 08 '22 16:03 ryanheise

Ok, I've rewrote just_audio_background, without adding MediaAction.seek into system actions, but it is still showing the seek bar in notification. I've found similar issue in stackoverflow . So I'll open an issue in audio_service. Feel free to close this issue, if you are not going to implement the feature for controls through just_audio directly

nzackoya avatar Mar 08 '22 18:03 nzackoya

I'll leave it open to see if anyone else has similar use cases from which I can make a sensible API design decision (but it is likely to remain open for the long term since it is a specialised feature.)

ryanheise avatar Mar 09 '22 01:03 ryanheise