Add flag to onPlaybackResumption
to indicate whether playback should be started or not.
#1764
Labels
onPlaybackResumption
to indicate whether playback should be started or not.
#1764
Use case description
MediaLibrarySessionCallback
'sonPlaybackResumption
is called fromMediaSession.handleMediaControllerPlayRequest
to handle incoming play requests from MediaControllers, or fromMediaLibrarySession.getRecentMediaItemAtDeviceBootTime
to populate the media notification at boot time. While the former should end up with playback (or else resulting in aForegroundServiceDidNotStartInTimeException
), 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.
The text was updated successfully, but these errors were encountered: