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
b33496ae
authored
Jul 22, 2021
by
kimvde
Committed by
kim-vde
Jul 23, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Deprecate ControlDispatcher in MediaSessionConnector
PiperOrigin-RevId: 386227630
parent
13ff72d8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
29 deletions
RELEASENOTES.md
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/RepeatModeActionProvider.java
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueEditor.java
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueNavigator.java
RELEASENOTES.md
View file @
b33496ae
...
@@ -118,6 +118,11 @@
...
@@ -118,6 +118,11 @@
*
RTSP:
*
RTSP:
*
Use standard RTSP header names.
*
Use standard RTSP header names.
(
[
#9182
](
https://github.com/google/ExoPlayer/issues/9182
)
).
(
[
#9182
](
https://github.com/google/ExoPlayer/issues/9182
)
).
*
MediaSession extension:
*
Deprecate
`setControlDispatcher`
in
`MediaSessionConnector`
. The
`ControlDispatcher`
parameter has also been deprecated in all
`MediaSessionConnector`
listener methods.
### 2.14.2 (2021-07-20)
### 2.14.2 (2021-07-20)
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java
View file @
b33496ae
...
@@ -48,6 +48,7 @@ import com.google.android.exoplayer2.C;
...
@@ -48,6 +48,7 @@ import com.google.android.exoplayer2.C;
import
com.google.android.exoplayer2.ControlDispatcher
;
import
com.google.android.exoplayer2.ControlDispatcher
;
import
com.google.android.exoplayer2.DefaultControlDispatcher
;
import
com.google.android.exoplayer2.DefaultControlDispatcher
;
import
com.google.android.exoplayer2.ExoPlayerLibraryInfo
;
import
com.google.android.exoplayer2.ExoPlayerLibraryInfo
;
import
com.google.android.exoplayer2.ForwardingPlayer
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.PlaybackException
;
import
com.google.android.exoplayer2.PlaybackException
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
...
@@ -169,12 +170,13 @@ public final class MediaSessionConnector {
...
@@ -169,12 +170,13 @@ public final class MediaSessionConnector {
public
interface
CommandReceiver
{
public
interface
CommandReceiver
{
/**
/**
* See {@link MediaSessionCompat.Callback#onCommand(String, Bundle, ResultReceiver)}. The
* See {@link MediaSessionCompat.Callback#onCommand(String, Bundle, ResultReceiver)}. The
* receiver may handle the command, but is not required to do so. Changes to the player should
* receiver may handle the command, but is not required to do so.
* be made via the {@link ControlDispatcher}.
*
*
* @param player The player connected to the media session.
* @param player The player connected to the media session.
* @param controlDispatcher A {@link ControlDispatcher} that should be used for dispatching
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* changes to the player.
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* @param command The command name.
* @param command The command name.
* @param extras Optional parameters for the command, may be null.
* @param extras Optional parameters for the command, may be null.
* @param cb A result receiver to which a result may be sent by the command, may be null.
* @param cb A result receiver to which a result may be sent by the command, may be null.
...
@@ -182,7 +184,7 @@ public final class MediaSessionConnector {
...
@@ -182,7 +184,7 @@ public final class MediaSessionConnector {
*/
*/
boolean
onCommand
(
boolean
onCommand
(
Player
player
,
Player
player
,
ControlDispatcher
controlDispatcher
,
@Deprecated
ControlDispatcher
controlDispatcher
,
String
command
,
String
command
,
@Nullable
Bundle
extras
,
@Nullable
Bundle
extras
,
@Nullable
ResultReceiver
cb
);
@Nullable
ResultReceiver
cb
);
...
@@ -294,26 +296,32 @@ public final class MediaSessionConnector {
...
@@ -294,26 +296,32 @@ public final class MediaSessionConnector {
* See {@link MediaSessionCompat.Callback#onSkipToPrevious()}.
* See {@link MediaSessionCompat.Callback#onSkipToPrevious()}.
*
*
* @param player The player connected to the media session.
* @param player The player connected to the media session.
* @param controlDispatcher A {@link ControlDispatcher} that should be used for dispatching
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* changes to the player.
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
*/
void
onSkipToPrevious
(
Player
player
,
ControlDispatcher
controlDispatcher
);
void
onSkipToPrevious
(
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
);
/**
/**
* See {@link MediaSessionCompat.Callback#onSkipToQueueItem(long)}.
* See {@link MediaSessionCompat.Callback#onSkipToQueueItem(long)}.
*
*
* @param player The player connected to the media session.
* @param player The player connected to the media session.
* @param controlDispatcher A {@link ControlDispatcher} that should be used for dispatching
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* changes to the player.
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
*/
void
onSkipToQueueItem
(
Player
player
,
ControlDispatcher
controlDispatcher
,
long
id
);
void
onSkipToQueueItem
(
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
,
long
id
);
/**
/**
* See {@link MediaSessionCompat.Callback#onSkipToNext()}.
* See {@link MediaSessionCompat.Callback#onSkipToNext()}.
*
*
* @param player The player connected to the media session.
* @param player The player connected to the media session.
* @param controlDispatcher A {@link ControlDispatcher} that should be used for dispatching
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* changes to the player.
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
*/
void
onSkipToNext
(
Player
player
,
ControlDispatcher
controlDispatcher
);
void
onSkipToNext
(
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
);
}
}
/** Handles media session queue edits. */
/** Handles media session queue edits. */
...
@@ -366,13 +374,15 @@ public final class MediaSessionConnector {
...
@@ -366,13 +374,15 @@ public final class MediaSessionConnector {
* See {@link MediaSessionCompat.Callback#onMediaButtonEvent(Intent)}.
* See {@link MediaSessionCompat.Callback#onMediaButtonEvent(Intent)}.
*
*
* @param player The {@link Player}.
* @param player The {@link Player}.
* @param controlDispatcher A {@link ControlDispatcher} that should be used for dispatching
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* changes to the player.
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* @param mediaButtonEvent The {@link Intent}.
* @param mediaButtonEvent The {@link Intent}.
* @return True if the event was handled, false otherwise.
* @return True if the event was handled, false otherwise.
*/
*/
boolean
onMediaButtonEvent
(
boolean
onMediaButtonEvent
(
Player
player
,
ControlDispatcher
controlDispatcher
,
Intent
mediaButtonEvent
);
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
,
Intent
mediaButtonEvent
);
}
}
/**
/**
...
@@ -384,13 +394,18 @@ public final class MediaSessionConnector {
...
@@ -384,13 +394,18 @@ public final class MediaSessionConnector {
* Called when a custom action provided by this provider is sent to the media session.
* Called when a custom action provided by this provider is sent to the media session.
*
*
* @param player The player connected to the media session.
* @param player The player connected to the media session.
* @param controlDispatcher A {@link ControlDispatcher} that should be used for dispatching
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* changes to the player.
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)}).
* @param action The name of the action which was sent by a media controller.
* @param action The name of the action which was sent by a media controller.
* @param extras Optional extras sent by a media controller, may be null.
* @param extras Optional extras sent by a media controller, may be null.
*/
*/
void
onCustomAction
(
void
onCustomAction
(
Player
player
,
ControlDispatcher
controlDispatcher
,
String
action
,
@Nullable
Bundle
extras
);
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
,
String
action
,
@Nullable
Bundle
extras
);
/**
/**
* Returns a {@link PlaybackStateCompat.CustomAction} which will be published to the media
* Returns a {@link PlaybackStateCompat.CustomAction} which will be published to the media
...
@@ -545,10 +560,11 @@ public final class MediaSessionConnector {
...
@@ -545,10 +560,11 @@ public final class MediaSessionConnector {
}
}
/**
/**
*
Sets the {@link ControlDispatcher}
.
*
@deprecated Use a {@link ForwardingPlayer} and pass it to {@link #setPlayer(Player)} instead
.
*
*
You can also customize some operations when configuring the player (for example by using
*
@param controlDispatcher The {@link ControlDispatcher}
.
*
{@code SimpleExoPlayer.Builder#setSeekBackIncrementMs(long)})
.
*/
*/
@Deprecated
public
void
setControlDispatcher
(
ControlDispatcher
controlDispatcher
)
{
public
void
setControlDispatcher
(
ControlDispatcher
controlDispatcher
)
{
if
(
this
.
controlDispatcher
!=
controlDispatcher
)
{
if
(
this
.
controlDispatcher
!=
controlDispatcher
)
{
this
.
controlDispatcher
=
controlDispatcher
;
this
.
controlDispatcher
=
controlDispatcher
;
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/RepeatModeActionProvider.java
View file @
b33496ae
...
@@ -65,7 +65,10 @@ public final class RepeatModeActionProvider implements MediaSessionConnector.Cus
...
@@ -65,7 +65,10 @@ public final class RepeatModeActionProvider implements MediaSessionConnector.Cus
@Override
@Override
public
void
onCustomAction
(
public
void
onCustomAction
(
Player
player
,
ControlDispatcher
controlDispatcher
,
String
action
,
@Nullable
Bundle
extras
)
{
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
,
String
action
,
@Nullable
Bundle
extras
)
{
int
mode
=
player
.
getRepeatMode
();
int
mode
=
player
.
getRepeatMode
();
int
proposedMode
=
RepeatModeUtil
.
getNextRepeatMode
(
mode
,
repeatToggleModes
);
int
proposedMode
=
RepeatModeUtil
.
getNextRepeatMode
(
mode
,
repeatToggleModes
);
if
(
mode
!=
proposedMode
)
{
if
(
mode
!=
proposedMode
)
{
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueEditor.java
View file @
b33496ae
...
@@ -179,7 +179,7 @@ public final class TimelineQueueEditor
...
@@ -179,7 +179,7 @@ public final class TimelineQueueEditor
@Override
@Override
public
boolean
onCommand
(
public
boolean
onCommand
(
Player
player
,
Player
player
,
ControlDispatcher
controlDispatcher
,
@Deprecated
ControlDispatcher
controlDispatcher
,
String
command
,
String
command
,
@Nullable
Bundle
extras
,
@Nullable
Bundle
extras
,
@Nullable
ResultReceiver
cb
)
{
@Nullable
ResultReceiver
cb
)
{
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueNavigator.java
View file @
b33496ae
...
@@ -144,12 +144,13 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
...
@@ -144,12 +144,13 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
}
}
@Override
@Override
public
void
onSkipToPrevious
(
Player
player
,
ControlDispatcher
controlDispatcher
)
{
public
void
onSkipToPrevious
(
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
)
{
controlDispatcher
.
dispatchPrevious
(
player
);
controlDispatcher
.
dispatchPrevious
(
player
);
}
}
@Override
@Override
public
void
onSkipToQueueItem
(
Player
player
,
ControlDispatcher
controlDispatcher
,
long
id
)
{
public
void
onSkipToQueueItem
(
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
,
long
id
)
{
Timeline
timeline
=
player
.
getCurrentTimeline
();
Timeline
timeline
=
player
.
getCurrentTimeline
();
if
(
timeline
.
isEmpty
()
||
player
.
isPlayingAd
())
{
if
(
timeline
.
isEmpty
()
||
player
.
isPlayingAd
())
{
return
;
return
;
...
@@ -161,7 +162,7 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
...
@@ -161,7 +162,7 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
}
}
@Override
@Override
public
void
onSkipToNext
(
Player
player
,
ControlDispatcher
controlDispatcher
)
{
public
void
onSkipToNext
(
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
)
{
controlDispatcher
.
dispatchNext
(
player
);
controlDispatcher
.
dispatchNext
(
player
);
}
}
...
@@ -170,7 +171,7 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
...
@@ -170,7 +171,7 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
@Override
@Override
public
boolean
onCommand
(
public
boolean
onCommand
(
Player
player
,
Player
player
,
ControlDispatcher
controlDispatcher
,
@Deprecated
ControlDispatcher
controlDispatcher
,
String
command
,
String
command
,
@Nullable
Bundle
extras
,
@Nullable
Bundle
extras
,
@Nullable
ResultReceiver
cb
)
{
@Nullable
ResultReceiver
cb
)
{
...
...
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