Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bbec6bce
authored
Dec 03, 2021
by
bachinger
Committed by
Oliver Woodman
Dec 06, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Make mapping of STATE_IDLE configurable
PiperOrigin-RevId: 413922123
parent
b7296bc3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java
View file @
bbec6bce
...
...
@@ -467,6 +467,7 @@ public final class MediaSessionConnector {
private
boolean
metadataDeduplicationEnabled
;
private
boolean
dispatchUnsupportedActionsEnabled
;
private
boolean
clearMediaItemsOnStop
;
private
boolean
mapIdleToStopped
;
/**
* Creates an instance.
...
...
@@ -710,6 +711,15 @@ public final class MediaSessionConnector {
}
/**
* Sets whether {@link Player#STATE_IDLE} should be mapped to {@link
* PlaybackStateCompat#STATE_STOPPED}. The default is false {@link Player#STATE_IDLE} which maps
* to {@link PlaybackStateCompat#STATE_NONE}.
*/
public
void
setMapStateIdleToSessionStateStopped
(
boolean
mapIdleToStopped
)
{
this
.
mapIdleToStopped
=
mapIdleToStopped
;
}
/**
* Sets whether {@link MediaMetadataProvider#sameAs(MediaMetadataCompat, MediaMetadataCompat)}
* should be consulted before calling {@link MediaSessionCompat#setMetadata(MediaMetadataCompat)}.
*
...
...
@@ -984,7 +994,7 @@ public final class MediaSessionConnector {
player
.
seekTo
(
mediaItemIndex
,
positionMs
);
}
private
static
int
getMediaSessionPlaybackState
(
private
int
getMediaSessionPlaybackState
(
@Player
.
State
int
exoPlayerPlaybackState
,
boolean
playWhenReady
)
{
switch
(
exoPlayerPlaybackState
)
{
case
Player
.
STATE_BUFFERING
:
...
...
@@ -997,7 +1007,9 @@ public final class MediaSessionConnector {
return
PlaybackStateCompat
.
STATE_STOPPED
;
case
Player
.
STATE_IDLE
:
default
:
return
PlaybackStateCompat
.
STATE_NONE
;
return
mapIdleToStopped
?
PlaybackStateCompat
.
STATE_STOPPED
:
PlaybackStateCompat
.
STATE_NONE
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment