Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable skip buttons in control center #314

Closed
erikatvojo opened this issue May 10, 2020 · 8 comments
Closed

Disable skip buttons in control center #314

erikatvojo opened this issue May 10, 2020 · 8 comments
Assignees
Labels
3 testing enhancement New feature or request

Comments

@erikatvojo
Copy link

Is your feature request related to a problem? Please describe.
On iOS and Android the skip buttons are not disabled (greyed out) if there's only one item in the queue or if you are playing an item at either end of the queue.

Describe the solution you'd like
It would be great if the skip buttons were greyed out if there's only one item in the queue or if you are playing an item at either end of the queue.

Describe alternatives you've considered
On Android it's possible to remove the skip buttons if you are only playing one item, but on iOS I can't see an option to disable the skip button in the control center.

Additional context
Add any other context or screenshots about the feature request here.

@ariefwijaya
Copy link

I think, you can remove the button instead in BackgroundAudioTask, just dont add the skip button (previous or next depend on your case) when you call

AudioServiceBackground.setState(
     controls: getControls(state), // do some logic here
     systemActions: [MediaAction.seekTo],
     basicState: state,
     position: position,
   );

@erikatvojo
Copy link
Author

That only works for Android, on iOS the skip button stays and are not greyed out even if the list returned by getControls(state) doesn't include skipToPreviousControl and skipToNextControl.

@diego-lipinski-de-castro

anyway to disable previous and next butons on iOS? Makes sense when youre streaming audio

@ryanheise
Copy link
Owner

The iOS implementation has been somewhat of a collaborative effort so far, and so pull requests are always welcome. My first implementation got the basics working, and then more support has been added over time through the contributions of many people.

My suggestion for anyone who wants to have a go at making a PR is to look at the open PR for Swift which I believe respects the controls and systemActions parameters, and uses them to configure which buttons to enable in the control center (#228 ).

Eventually, I'd like to continue work on the Swift implementation, but for now probably the quickest approach would be to make a minor change to the current Objective C implementation to implement this, perhaps using the Swift PR as a reference to get a general idea of how to do it.

@ryanheise
Copy link
Owner

I have just implemented this on git master. I have also updated the documentation of AudioServiceBackground.setState to explain how to specify which controls appear via the controls and systemActions parameters.

Please let me know how how it goes.

@ryanheise
Copy link
Owner

I should clarify that while you can't "disable" the buttons, you can now choose which ones should appear in different states, for both Android and iOS.

@ryanheise
Copy link
Owner

This is now released in 0.12.0 so I'll close this issue.

@github-actions
Copy link

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 testing enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants