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

Add flag to onPlaybackResumption to indicate whether playback should be started or not. #1764

Open
kelmer44 opened this issue Sep 27, 2024 · 0 comments

Comments

@kelmer44
Copy link

Use case description

MediaLibrarySessionCallback's onPlaybackResumption is called from MediaSession.handleMediaControllerPlayRequest to handle incoming play requests from MediaControllers, or from MediaLibrarySession.getRecentMediaItemAtDeviceBootTime to populate the media notification at boot time. While the former should end up with playback (or else resulting in a ForegroundServiceDidNotStartInTimeException), the latter should never explicitly call playback to avoid playing content upon device reboot.

Although for simpler cases media3 can handle this situation internally, for more complex cases where playback can't be resolved by merely returning a list of MediaItems in onPlaybackResumption, it would be useful to have a way to determine within this function whether the call should result in playback or not.

Proposed solution

onPlaybackResumption may have an extra boolean parameter to indicate this situation, or the incoming controller info might contain an indication that the request is coming from MediaLibrary to populate the last media sesion within the OS.

Alternatives considered

I currently inspect the call stack to reach this conclusion but this is hacky and far from ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants