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
746ad2e6
authored
Oct 14, 2021
by
kimvde
Committed by
Oliver Woodman
Oct 14, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove deprecated ControlDispatcher from API surface
PiperOrigin-RevId: 403101980
parent
059dfaef
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
29 additions
and
227 deletions
RELEASENOTES.md
extensions/leanback/src/main/java/com/google/android/exoplayer2/ext/leanback/LeanbackPlayerAdapter.java
extensions/media2/src/androidTest/java/com/google/android/exoplayer2/ext/media2/SessionPlayerConnectorTest.java
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerWrapper.java
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/SessionPlayerConnector.java
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
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java
RELEASENOTES.md
View file @
746ad2e6
...
@@ -107,6 +107,12 @@
...
@@ -107,6 +107,12 @@
`Player.EVENT_MEDIA_METADATA_CHANGED`
for convenient access to
`Player.EVENT_MEDIA_METADATA_CHANGED`
for convenient access to
structured metadata, or access the raw static metadata directly from the
structured metadata, or access the raw static metadata directly from the
`TrackSelection#getFormat()`
.
`TrackSelection#getFormat()`
.
*
Remove
`setControlDispatcher`
from
`PlayerWrapper`
,
`SessionPlayerConnector`
,
`MediaSessionConnector`
,
`PlayerControlView`
,
`PlayerNotificationManager`
,
`PlayerView`
,
`StyledPlayerControlView`
,
`StyledPlayerView`
and
`LeanbackPlayerAdapter`
. Operations can be
customized by using a
`ForwardingPlayer`
, or when configuring the player
(for example by using
`ExoPlayer.Builder.setSeekBackIncrementMs`
).
### 2.15.1 (2021-09-20)
### 2.15.1 (2021-09-20)
...
...
extensions/leanback/src/main/java/com/google/android/exoplayer2/ext/leanback/LeanbackPlayerAdapter.java
View file @
746ad2e6
...
@@ -29,7 +29,6 @@ import com.google.android.exoplayer2.C;
...
@@ -29,7 +29,6 @@ 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.PlaybackException
;
import
com.google.android.exoplayer2.PlaybackException
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player.DiscontinuityReason
;
import
com.google.android.exoplayer2.Player.DiscontinuityReason
;
...
@@ -77,17 +76,6 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
...
@@ -77,17 +76,6 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
}
}
/**
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to the constructor instead. You can also
* customize some operations when configuring the player (for example by using {@code
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public
void
setControlDispatcher
(
@Nullable
ControlDispatcher
controlDispatcher
)
{
this
.
controlDispatcher
=
controlDispatcher
==
null
?
new
DefaultControlDispatcher
()
:
controlDispatcher
;
}
/**
* Sets the optional {@link ErrorMessageProvider}.
* Sets the optional {@link ErrorMessageProvider}.
*
*
* @param errorMessageProvider The {@link ErrorMessageProvider}.
* @param errorMessageProvider The {@link ErrorMessageProvider}.
...
...
extensions/media2/src/androidTest/java/com/google/android/exoplayer2/ext/media2/SessionPlayerConnectorTest.java
View file @
746ad2e6
...
@@ -42,8 +42,6 @@ import androidx.test.filters.LargeTest;
...
@@ -42,8 +42,6 @@ import androidx.test.filters.LargeTest;
import
androidx.test.filters.MediumTest
;
import
androidx.test.filters.MediumTest
;
import
androidx.test.filters.SmallTest
;
import
androidx.test.filters.SmallTest
;
import
androidx.test.platform.app.InstrumentationRegistry
;
import
androidx.test.platform.app.InstrumentationRegistry
;
import
com.google.android.exoplayer2.ControlDispatcher
;
import
com.google.android.exoplayer2.DefaultControlDispatcher
;
import
com.google.android.exoplayer2.ExoPlayer
;
import
com.google.android.exoplayer2.ExoPlayer
;
import
com.google.android.exoplayer2.ForwardingPlayer
;
import
com.google.android.exoplayer2.ForwardingPlayer
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
...
@@ -154,37 +152,6 @@ public class SessionPlayerConnectorTest {
...
@@ -154,37 +152,6 @@ public class SessionPlayerConnectorTest {
@Test
@Test
@LargeTest
@LargeTest
public
void
play_withCustomControlDispatcher_isSkipped
()
throws
Exception
{
if
(
Looper
.
myLooper
()
==
null
)
{
Looper
.
prepare
();
}
ControlDispatcher
controlDispatcher
=
new
DefaultControlDispatcher
()
{
@Override
public
boolean
dispatchSetPlayWhenReady
(
Player
player
,
boolean
playWhenReady
)
{
return
false
;
}
};
ExoPlayer
exoPlayer
=
null
;
SessionPlayerConnector
playerConnector
=
null
;
try
{
exoPlayer
=
new
ExoPlayer
.
Builder
(
context
).
setLooper
(
Looper
.
myLooper
()).
build
();
playerConnector
=
new
SessionPlayerConnector
(
exoPlayer
,
new
DefaultMediaItemConverter
());
playerConnector
.
setControlDispatcher
(
controlDispatcher
);
assertPlayerResult
(
playerConnector
.
play
(),
RESULT_INFO_SKIPPED
);
}
finally
{
if
(
playerConnector
!=
null
)
{
playerConnector
.
close
();
}
if
(
exoPlayer
!=
null
)
{
exoPlayer
.
release
();
}
}
}
@Test
@LargeTest
public
void
play_withForwardingPlayer_isSkipped
()
throws
Exception
{
public
void
play_withForwardingPlayer_isSkipped
()
throws
Exception
{
if
(
Looper
.
myLooper
()
==
null
)
{
if
(
Looper
.
myLooper
()
==
null
)
{
Looper
.
prepare
();
Looper
.
prepare
();
...
...
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerWrapper.java
View file @
746ad2e6
...
@@ -35,7 +35,6 @@ import androidx.media2.common.SessionPlayer;
...
@@ -35,7 +35,6 @@ import androidx.media2.common.SessionPlayer;
import
com.google.android.exoplayer2.C
;
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.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.PlaybackParameters
;
import
com.google.android.exoplayer2.PlaybackParameters
;
...
@@ -163,16 +162,6 @@ import java.util.List;
...
@@ -163,16 +162,6 @@ import java.util.List;
}
}
}
}
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to the constructor instead. You can also
* customize some operations when configuring the player (for example by using {@code
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public
void
setControlDispatcher
(
ControlDispatcher
controlDispatcher
)
{
this
.
controlDispatcher
=
controlDispatcher
;
}
public
boolean
setMediaItem
(
androidx
.
media2
.
common
.
MediaItem
media2MediaItem
)
{
public
boolean
setMediaItem
(
androidx
.
media2
.
common
.
MediaItem
media2MediaItem
)
{
return
setPlaylist
(
Collections
.
singletonList
(
media2MediaItem
),
/* metadata= */
null
);
return
setPlaylist
(
Collections
.
singletonList
(
media2MediaItem
),
/* metadata= */
null
);
}
}
...
...
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/SessionPlayerConnector.java
View file @
746ad2e6
...
@@ -29,9 +29,7 @@ import androidx.media2.common.FileMediaItem;
...
@@ -29,9 +29,7 @@ import androidx.media2.common.FileMediaItem;
import
androidx.media2.common.MediaItem
;
import
androidx.media2.common.MediaItem
;
import
androidx.media2.common.MediaMetadata
;
import
androidx.media2.common.MediaMetadata
;
import
androidx.media2.common.SessionPlayer
;
import
androidx.media2.common.SessionPlayer
;
import
com.google.android.exoplayer2.ControlDispatcher
;
import
com.google.android.exoplayer2.ExoPlayerLibraryInfo
;
import
com.google.android.exoplayer2.ExoPlayerLibraryInfo
;
import
com.google.android.exoplayer2.ForwardingPlayer
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Log
;
import
com.google.android.exoplayer2.util.Log
;
...
@@ -113,16 +111,6 @@ public final class SessionPlayerConnector extends SessionPlayer {
...
@@ -113,16 +111,6 @@ public final class SessionPlayerConnector extends SessionPlayer {
playerCommandQueue
=
new
PlayerCommandQueue
(
this
.
player
,
taskHandler
);
playerCommandQueue
=
new
PlayerCommandQueue
(
this
.
player
,
taskHandler
);
}
}
/**
* @deprecated Use a {@link ForwardingPlayer} and pass it to the constructor instead. You can also
* customize some operations when configuring the player (for example by using {@code
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public
void
setControlDispatcher
(
ControlDispatcher
controlDispatcher
)
{
player
.
setControlDispatcher
(
controlDispatcher
);
}
@Override
@Override
public
ListenableFuture
<
PlayerResult
>
play
()
{
public
ListenableFuture
<
PlayerResult
>
play
()
{
return
playerCommandQueue
.
addCommand
(
return
playerCommandQueue
.
addCommand
(
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java
View file @
746ad2e6
...
@@ -48,7 +48,6 @@ import com.google.android.exoplayer2.C;
...
@@ -48,7 +48,6 @@ 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
;
...
@@ -173,21 +172,13 @@ public final class MediaSessionConnector {
...
@@ -173,21 +172,13 @@ public final class MediaSessionConnector {
* receiver may handle the command, but is not required to do so.
* receiver may handle the command, but is not required to do so.
*
*
* @param player The player connected to the media session.
* @param player The player connected to the media session.
* @param controlDispatcher This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* ExoPlayer.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.
* @return Whether the receiver handled the command.
* @return Whether the receiver handled the command.
*/
*/
boolean
onCommand
(
boolean
onCommand
(
Player
player
,
Player
player
,
String
command
,
@Nullable
Bundle
extras
,
@Nullable
ResultReceiver
cb
);
@Deprecated
ControlDispatcher
controlDispatcher
,
String
command
,
@Nullable
Bundle
extras
,
@Nullable
ResultReceiver
cb
);
}
}
/** Interface to which playback preparation and play actions are delegated. */
/** Interface to which playback preparation and play actions are delegated. */
...
@@ -296,32 +287,20 @@ public final class MediaSessionConnector {
...
@@ -296,32 +287,20 @@ 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 This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
*/
void
onSkipToPrevious
(
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
);
void
onSkipToPrevious
(
Player
player
);
/**
/**
* 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 This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
*/
void
onSkipToQueueItem
(
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
,
long
id
);
void
onSkipToQueueItem
(
Player
player
,
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 This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
*/
void
onSkipToNext
(
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
);
void
onSkipToNext
(
Player
player
);
}
}
/** Handles media session queue edits. */
/** Handles media session queue edits. */
...
@@ -374,15 +353,10 @@ public final class MediaSessionConnector {
...
@@ -374,15 +353,10 @@ 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 This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* ExoPlayer.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
,
Intent
mediaButtonEvent
);
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
,
Intent
mediaButtonEvent
);
}
}
/**
/**
...
@@ -394,18 +368,10 @@ public final class MediaSessionConnector {
...
@@ -394,18 +368,10 @@ 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 This parameter is deprecated. Use {@code player} instead. Operations
* can be customized by passing a {@link ForwardingPlayer} to {@link #setPlayer(Player)}, or
* when configuring the player (for example by using {@code
* ExoPlayer.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
,
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
...
@@ -560,19 +526,6 @@ public final class MediaSessionConnector {
...
@@ -560,19 +526,6 @@ public final class MediaSessionConnector {
}
}
/**
/**
* @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
* {@code ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public
void
setControlDispatcher
(
ControlDispatcher
controlDispatcher
)
{
if
(
this
.
controlDispatcher
!=
controlDispatcher
)
{
this
.
controlDispatcher
=
controlDispatcher
;
invalidateMediaSessionPlaybackState
();
}
}
/**
* Sets the {@link MediaButtonEventHandler}. Pass {@code null} if the media button event should be
* Sets the {@link MediaButtonEventHandler}. Pass {@code null} if the media button event should be
* handled by {@link MediaSessionCompat.Callback#onMediaButtonEvent(Intent)}.
* handled by {@link MediaSessionCompat.Callback#onMediaButtonEvent(Intent)}.
*
*
...
@@ -1317,28 +1270,28 @@ public final class MediaSessionConnector {
...
@@ -1317,28 +1270,28 @@ public final class MediaSessionConnector {
@Override
@Override
public
void
onSkipToNext
()
{
public
void
onSkipToNext
()
{
if
(
canDispatchToQueueNavigator
(
PlaybackStateCompat
.
ACTION_SKIP_TO_NEXT
))
{
if
(
canDispatchToQueueNavigator
(
PlaybackStateCompat
.
ACTION_SKIP_TO_NEXT
))
{
queueNavigator
.
onSkipToNext
(
player
,
controlDispatcher
);
queueNavigator
.
onSkipToNext
(
player
);
}
}
}
}
@Override
@Override
public
void
onSkipToPrevious
()
{
public
void
onSkipToPrevious
()
{
if
(
canDispatchToQueueNavigator
(
PlaybackStateCompat
.
ACTION_SKIP_TO_PREVIOUS
))
{
if
(
canDispatchToQueueNavigator
(
PlaybackStateCompat
.
ACTION_SKIP_TO_PREVIOUS
))
{
queueNavigator
.
onSkipToPrevious
(
player
,
controlDispatcher
);
queueNavigator
.
onSkipToPrevious
(
player
);
}
}
}
}
@Override
@Override
public
void
onSkipToQueueItem
(
long
id
)
{
public
void
onSkipToQueueItem
(
long
id
)
{
if
(
canDispatchToQueueNavigator
(
PlaybackStateCompat
.
ACTION_SKIP_TO_QUEUE_ITEM
))
{
if
(
canDispatchToQueueNavigator
(
PlaybackStateCompat
.
ACTION_SKIP_TO_QUEUE_ITEM
))
{
queueNavigator
.
onSkipToQueueItem
(
player
,
controlDispatcher
,
id
);
queueNavigator
.
onSkipToQueueItem
(
player
,
id
);
}
}
}
}
@Override
@Override
public
void
onCustomAction
(
String
action
,
@Nullable
Bundle
extras
)
{
public
void
onCustomAction
(
String
action
,
@Nullable
Bundle
extras
)
{
if
(
player
!=
null
&&
customActionMap
.
containsKey
(
action
))
{
if
(
player
!=
null
&&
customActionMap
.
containsKey
(
action
))
{
customActionMap
.
get
(
action
).
onCustomAction
(
player
,
controlDispatcher
,
action
,
extras
);
customActionMap
.
get
(
action
).
onCustomAction
(
player
,
action
,
extras
);
invalidateMediaSessionPlaybackState
();
invalidateMediaSessionPlaybackState
();
}
}
}
}
...
@@ -1347,14 +1300,12 @@ public final class MediaSessionConnector {
...
@@ -1347,14 +1300,12 @@ public final class MediaSessionConnector {
public
void
onCommand
(
String
command
,
@Nullable
Bundle
extras
,
@Nullable
ResultReceiver
cb
)
{
public
void
onCommand
(
String
command
,
@Nullable
Bundle
extras
,
@Nullable
ResultReceiver
cb
)
{
if
(
player
!=
null
)
{
if
(
player
!=
null
)
{
for
(
int
i
=
0
;
i
<
commandReceivers
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
commandReceivers
.
size
();
i
++)
{
if
(
commandReceivers
.
get
(
i
).
onCommand
(
player
,
co
ntrolDispatcher
,
co
mmand
,
extras
,
cb
))
{
if
(
commandReceivers
.
get
(
i
).
onCommand
(
player
,
command
,
extras
,
cb
))
{
return
;
return
;
}
}
}
}
for
(
int
i
=
0
;
i
<
customCommandReceivers
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
customCommandReceivers
.
size
();
i
++)
{
if
(
customCommandReceivers
if
(
customCommandReceivers
.
get
(
i
).
onCommand
(
player
,
command
,
extras
,
cb
))
{
.
get
(
i
)
.
onCommand
(
player
,
controlDispatcher
,
command
,
extras
,
cb
))
{
return
;
return
;
}
}
}
}
...
@@ -1456,8 +1407,7 @@ public final class MediaSessionConnector {
...
@@ -1456,8 +1407,7 @@ public final class MediaSessionConnector {
public
boolean
onMediaButtonEvent
(
Intent
mediaButtonEvent
)
{
public
boolean
onMediaButtonEvent
(
Intent
mediaButtonEvent
)
{
boolean
isHandled
=
boolean
isHandled
=
canDispatchMediaButtonEvent
()
canDispatchMediaButtonEvent
()
&&
mediaButtonEventHandler
.
onMediaButtonEvent
(
&&
mediaButtonEventHandler
.
onMediaButtonEvent
(
player
,
mediaButtonEvent
);
player
,
controlDispatcher
,
mediaButtonEvent
);
return
isHandled
||
super
.
onMediaButtonEvent
(
mediaButtonEvent
);
return
isHandled
||
super
.
onMediaButtonEvent
(
mediaButtonEvent
);
}
}
}
}
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/RepeatModeActionProvider.java
View file @
746ad2e6
...
@@ -19,7 +19,6 @@ import android.content.Context;
...
@@ -19,7 +19,6 @@ import android.content.Context;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.v4.media.session.PlaybackStateCompat
;
import
android.support.v4.media.session.PlaybackStateCompat
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.ControlDispatcher
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.util.RepeatModeUtil
;
import
com.google.android.exoplayer2.util.RepeatModeUtil
;
...
@@ -64,15 +63,11 @@ public final class RepeatModeActionProvider implements MediaSessionConnector.Cus
...
@@ -64,15 +63,11 @@ public final class RepeatModeActionProvider implements MediaSessionConnector.Cus
}
}
@Override
@Override
public
void
onCustomAction
(
public
void
onCustomAction
(
Player
player
,
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
)
{
controlDispatcher
.
dispatchSetRepeatMode
(
player
,
proposedMode
);
player
.
setRepeatMode
(
proposedMode
);
}
}
}
}
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueEditor.java
View file @
746ad2e6
...
@@ -22,7 +22,6 @@ import android.support.v4.media.session.MediaControllerCompat;
...
@@ -22,7 +22,6 @@ import android.support.v4.media.session.MediaControllerCompat;
import
android.support.v4.media.session.MediaSessionCompat
;
import
android.support.v4.media.session.MediaSessionCompat
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.ControlDispatcher
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
...
@@ -178,11 +177,7 @@ public final class TimelineQueueEditor
...
@@ -178,11 +177,7 @@ public final class TimelineQueueEditor
@Override
@Override
public
boolean
onCommand
(
public
boolean
onCommand
(
Player
player
,
Player
player
,
String
command
,
@Nullable
Bundle
extras
,
@Nullable
ResultReceiver
cb
)
{
@Deprecated
ControlDispatcher
controlDispatcher
,
String
command
,
@Nullable
Bundle
extras
,
@Nullable
ResultReceiver
cb
)
{
if
(!
COMMAND_MOVE_QUEUE_ITEM
.
equals
(
command
)
||
extras
==
null
)
{
if
(!
COMMAND_MOVE_QUEUE_ITEM
.
equals
(
command
)
||
extras
==
null
)
{
return
false
;
return
false
;
}
}
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueNavigator.java
View file @
746ad2e6
...
@@ -27,7 +27,6 @@ import android.support.v4.media.session.MediaSessionCompat;
...
@@ -27,7 +27,6 @@ import android.support.v4.media.session.MediaSessionCompat;
import
android.support.v4.media.session.PlaybackStateCompat
;
import
android.support.v4.media.session.PlaybackStateCompat
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.ControlDispatcher
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Timeline
;
import
com.google.android.exoplayer2.Timeline
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Assertions
;
...
@@ -144,37 +143,32 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
...
@@ -144,37 +143,32 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
}
}
@Override
@Override
public
void
onSkipToPrevious
(
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
)
{
public
void
onSkipToPrevious
(
Player
player
)
{
controlDispatcher
.
dispatchPrevious
(
player
);
player
.
seekToPrevious
(
);
}
}
@Override
@Override
public
void
onSkipToQueueItem
(
public
void
onSkipToQueueItem
(
Player
player
,
long
id
)
{
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
;
}
}
int
windowIndex
=
(
int
)
id
;
int
windowIndex
=
(
int
)
id
;
if
(
0
<=
windowIndex
&&
windowIndex
<
timeline
.
getWindowCount
())
{
if
(
0
<=
windowIndex
&&
windowIndex
<
timeline
.
getWindowCount
())
{
controlDispatcher
.
dispatchSeekTo
(
player
,
windowIndex
,
C
.
TIME_UNSET
);
player
.
seekToDefaultPosition
(
windowIndex
);
}
}
}
}
@Override
@Override
public
void
onSkipToNext
(
Player
player
,
@Deprecated
ControlDispatcher
controlDispatcher
)
{
public
void
onSkipToNext
(
Player
player
)
{
controlDispatcher
.
dispatchNext
(
player
);
player
.
seekToNext
(
);
}
}
// CommandReceiver implementation.
// CommandReceiver implementation.
@Override
@Override
public
boolean
onCommand
(
public
boolean
onCommand
(
Player
player
,
Player
player
,
String
command
,
@Nullable
Bundle
extras
,
@Nullable
ResultReceiver
cb
)
{
@Deprecated
ControlDispatcher
controlDispatcher
,
String
command
,
@Nullable
Bundle
extras
,
@Nullable
ResultReceiver
cb
)
{
return
false
;
return
false
;
}
}
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java
View file @
746ad2e6
...
@@ -52,9 +52,7 @@ import androidx.annotation.RequiresApi;
...
@@ -52,9 +52,7 @@ import androidx.annotation.RequiresApi;
import
com.google.android.exoplayer2.C
;
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.ExoPlayer
;
import
com.google.android.exoplayer2.ExoPlayerLibraryInfo
;
import
com.google.android.exoplayer2.ExoPlayerLibraryInfo
;
import
com.google.android.exoplayer2.ForwardingPlayer
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player.Events
;
import
com.google.android.exoplayer2.Player.Events
;
import
com.google.android.exoplayer2.Player.State
;
import
com.google.android.exoplayer2.Player.State
;
...
@@ -612,19 +610,6 @@ public class PlayerControlView extends FrameLayout {
...
@@ -612,19 +610,6 @@ public class PlayerControlView extends FrameLayout {
}
}
/**
/**
* @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
* {@link ExoPlayer.Builder#setSeekBackIncrementMs(long)}).
*/
@Deprecated
public
void
setControlDispatcher
(
ControlDispatcher
controlDispatcher
)
{
if
(
this
.
controlDispatcher
!=
controlDispatcher
)
{
this
.
controlDispatcher
=
controlDispatcher
;
updateNavigation
();
}
}
/**
* Sets whether the rewind button is shown.
* Sets whether the rewind button is shown.
*
*
* @param showRewindButton Whether the rewind button is shown.
* @param showRewindButton Whether the rewind button is shown.
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java
View file @
746ad2e6
...
@@ -54,7 +54,6 @@ import androidx.media.app.NotificationCompat.MediaStyle;
...
@@ -54,7 +54,6 @@ import androidx.media.app.NotificationCompat.MediaStyle;
import
com.google.android.exoplayer2.C
;
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.ForwardingPlayer
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.util.NotificationUtil
;
import
com.google.android.exoplayer2.util.NotificationUtil
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
...
@@ -817,21 +816,6 @@ public class PlayerNotificationManager {
...
@@ -817,21 +816,6 @@ public class PlayerNotificationManager {
}
}
/**
/**
* @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
* {@code ExoPlayer.Builder.setSeekBackIncrementMs(long)}), or configure whether the rewind
* and fast forward actions should be used with {{@link #setUseRewindAction(boolean)}} and
* {@link #setUseFastForwardAction(boolean)}.
*/
@Deprecated
public
final
void
setControlDispatcher
(
ControlDispatcher
controlDispatcher
)
{
if
(
this
.
controlDispatcher
!=
controlDispatcher
)
{
this
.
controlDispatcher
=
controlDispatcher
;
invalidate
();
}
}
/**
* Sets whether the next action should be used.
* Sets whether the next action should be used.
*
*
* @param useNextAction Whether to use the next action.
* @param useNextAction Whether to use the next action.
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
View file @
746ad2e6
...
@@ -46,8 +46,6 @@ import androidx.annotation.Nullable;
...
@@ -46,8 +46,6 @@ import androidx.annotation.Nullable;
import
androidx.annotation.RequiresApi
;
import
androidx.annotation.RequiresApi
;
import
androidx.core.content.ContextCompat
;
import
androidx.core.content.ContextCompat
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.ControlDispatcher
;
import
com.google.android.exoplayer2.ForwardingPlayer
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.PlaybackException
;
import
com.google.android.exoplayer2.PlaybackException
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
...
@@ -928,17 +926,6 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -928,17 +926,6 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
}
}
/**
/**
* @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
* {@code ExoPlayer.Builder.setSeekBackIncrementMs(long)}).
*/
@Deprecated
public
void
setControlDispatcher
(
ControlDispatcher
controlDispatcher
)
{
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setControlDispatcher
(
controlDispatcher
);
}
/**
* Sets whether the rewind button is shown.
* Sets whether the rewind button is shown.
*
*
* @param showRewindButton Whether the rewind button is shown.
* @param showRewindButton Whether the rewind button is shown.
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java
View file @
746ad2e6
...
@@ -832,19 +832,6 @@ public class StyledPlayerControlView extends FrameLayout {
...
@@ -832,19 +832,6 @@ public class StyledPlayerControlView extends FrameLayout {
}
}
/**
/**
* @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
* {@code ExoPlayer.Builder.setSeekBackIncrementMs(long)}).
*/
@Deprecated
public
void
setControlDispatcher
(
ControlDispatcher
controlDispatcher
)
{
if
(
this
.
controlDispatcher
!=
controlDispatcher
)
{
this
.
controlDispatcher
=
controlDispatcher
;
updateNavigation
();
}
}
/**
* Sets whether the rewind button is shown.
* Sets whether the rewind button is shown.
*
*
* @param showRewindButton Whether the rewind button is shown.
* @param showRewindButton Whether the rewind button is shown.
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java
View file @
746ad2e6
...
@@ -47,8 +47,6 @@ import androidx.annotation.Nullable;
...
@@ -47,8 +47,6 @@ import androidx.annotation.Nullable;
import
androidx.annotation.RequiresApi
;
import
androidx.annotation.RequiresApi
;
import
androidx.core.content.ContextCompat
;
import
androidx.core.content.ContextCompat
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.ControlDispatcher
;
import
com.google.android.exoplayer2.ForwardingPlayer
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.PlaybackException
;
import
com.google.android.exoplayer2.PlaybackException
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
...
@@ -945,17 +943,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
...
@@ -945,17 +943,6 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
}
}
/**
/**
* @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
* {@code ExoPlayer.Builder.setSeekBackIncrementMs(long)}).
*/
@Deprecated
public
void
setControlDispatcher
(
ControlDispatcher
controlDispatcher
)
{
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setControlDispatcher
(
controlDispatcher
);
}
/**
* Sets whether the rewind button is shown.
* Sets whether the rewind button is shown.
*
*
* @param showRewindButton Whether the rewind button is shown.
* @param showRewindButton Whether the rewind button is shown.
...
...
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