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

MediaSession play/pause events not propagated to LeanbackPlayerAdapter #10420

Closed
1 task
TheBeastLT opened this issue Jul 8, 2022 · 1 comment
Closed
1 task
Assignees
Labels

Comments

@TheBeastLT
Copy link

TheBeastLT commented Jul 8, 2022

ExoPlayer Version

2.18.0

Devices that reproduce the issue

Any Android TV

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

Connect player with a MediaSession and try to play/pause the video using mobile.

Expected result

When clicking play/pause the controls overlay should be triggered and their state updated.

It seems that the LeanbackPlayerAdapter listens to onPlaybackStateChanged player events, but play/pause action called from MediaSessionConnector. directly on a Player instance triggers only onPlayWhenReadyChanged event, which is not handled in the LeanbackPlayerAdapter.
By using ForwadingPlayer when setting player for the MediaSessionConnector. you can workaround this issue:

mediaSessionConnector.setPlayer(object : ForwardingPlayer(player) {
    override fun play() {
        playerAdapter.play()
    }

    override fun pause() {
        playerAdapter.pause()
    }

    override fun stop() {
        playerAdapter.pause()
    }
})

Actual result

Controls overlay is not triggered and play/pause action stays in previous incorrect state.

Media

Not applicable

Bug Report

@christosts
Copy link
Contributor

christosts commented Jul 11, 2022

Thank you for reporting this. We submitted a fix (this issue will be updated once the commit is pushed the dev-v2 branch) which will be included in the next release (2.18.1 or 2.19.0, which ever comes first).

rohitjoins pushed a commit to androidx/media that referenced this issue Jul 12, 2022
rohitjoins pushed a commit that referenced this issue Jul 12, 2022
#minor-release

Issue: #10420
PiperOrigin-RevId: 460223064
rohitjoins pushed a commit that referenced this issue Jul 15, 2022
#minor-release

Issue: #10420
PiperOrigin-RevId: 460223064
(cherry picked from commit c43d9f5)
rohitjoins pushed a commit to androidx/media that referenced this issue Jul 15, 2022
#minor-release

Issue: google/ExoPlayer#10420
PiperOrigin-RevId: 460223064
(cherry picked from commit 4eb34e4)
@google google locked and limited conversation to collaborators Sep 10, 2022
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

2 participants