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

MediaController::release() drops all existing requests. #99

Closed
Digipom opened this issue Jun 30, 2022 · 1 comment
Closed

MediaController::release() drops all existing requests. #99

Digipom opened this issue Jun 30, 2022 · 1 comment
Assignees
Labels

Comments

@Digipom
Copy link

Digipom commented Jun 30, 2022

[REQUIRED] Use case description

I want to be able to stop playback when exiting a screen. For example:
controller.stop()
controller.seekTo(0)
controller.release()

The problem here is that calling release() causes stop() and seekTo() to be dropped, so they never happen.

Proposed solution

release() should dispatch existing messages first, or there should be a clear way to not have the messages dropped. The current behavior is non-intuitive.

Alternatives considered

A clear and concise description of any alternative solutions you considered,
if applicable.

Handler.postDelayed({ controller.release }, 100)

@tonihei
Copy link
Collaborator

tonihei commented Jul 15, 2022

Thanks for reporting! We'll have a look into this.

rohitjoins pushed a commit that referenced this issue Jul 21, 2022
We currently clear all pending messages, including the one that flushes
pending commands to the MediaSession. To ensure all commands that have
been called before controller.release() are still sent, we can manually
trigger the flush message from the release call.

Related to handling the final flush because disconnecting the controller,
MediaSessionStub didn't post the removal of the controller to the
session thread, creating a race condition between removing the controller
and actually handling the flush.

Issue: #99
PiperOrigin-RevId: 462342860
microkatz pushed a commit that referenced this issue Nov 22, 2022
We currently clear all pending messages, including the one that flushes
pending commands to the MediaSession. To ensure all commands that have
been called before controller.release() are still sent, we can manually
trigger the flush message from the release call.

Related to handling the final flush because disconnecting the controller,
MediaSessionStub didn't post the removal of the controller to the
session thread, creating a race condition between removing the controller
and actually handling the flush.

Issue: #99
PiperOrigin-RevId: 462342860
(cherry picked from commit ee20969)
@androidx androidx locked and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants