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
11b09dd5
authored
Nov 09, 2020
by
bachinger
Committed by
Ian Baker
Nov 19, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add dispatchPrepare(player) to ControlDispatcher
Issue: #7882 PiperOrigin-RevId: 341394254
parent
81d68317
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
93 additions
and
36 deletions
RELEASENOTES.md
demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java
extensions/leanback/src/main/java/com/google/android/exoplayer2/ext/leanback/LeanbackPlayerAdapter.java
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java
library/core/src/main/java/com/google/android/exoplayer2/ControlDispatcher.java
library/core/src/main/java/com/google/android/exoplayer2/DefaultControlDispatcher.java
library/core/src/main/java/com/google/android/exoplayer2/PlaybackPreparer.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 @
11b09dd5
...
@@ -8,6 +8,14 @@
...
@@ -8,6 +8,14 @@
(
[
#8106
](
https://github.com/google/ExoPlayer/issues/8106
)
).
(
[
#8106
](
https://github.com/google/ExoPlayer/issues/8106
)
).
*
Suppress ProGuard warnings caused by Guava's compile-only dependencies
*
Suppress ProGuard warnings caused by Guava's compile-only dependencies
(
[
#8103
](
https://github.com/google/ExoPlayer/issues/8103
)
).
(
[
#8103
](
https://github.com/google/ExoPlayer/issues/8103
)
).
*
UI:
*
Add
`dispatchPrepare(Player)`
to
`ControlDispatcher`
and implement it in
`DefaultControlDispatcher`
. Deprecate
`PlaybackPreparer`
and
`setPlaybackPreparer`
in
`StyledPlayerView`
,
`StyledPlayerControlView`
,
`PlayerView`
,
`PlayerControlView`
,
`PlayerNotificationManager`
and
`LeanbackPlayerAdapter`
and use
`ControlDispatcher`
for dispatching
prepare instead
(
[
#7882
](
https://github.com/google/ExoPlayer/issues/7882
)
).
*
Extractors:
*
Extractors:
*
Matroska: Add support for 32-bit floating point PCM, and 8-bit and
*
Matroska: Add support for 32-bit floating point PCM, and 8-bit and
16-bit big endian integer PCM
16-bit big endian integer PCM
...
...
demos/main/src/main/java/com/google/android/exoplayer2/demo/PlayerActivity.java
View file @
11b09dd5
...
@@ -35,7 +35,6 @@ import androidx.appcompat.app.AppCompatActivity;
...
@@ -35,7 +35,6 @@ import androidx.appcompat.app.AppCompatActivity;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.MediaItem
;
import
com.google.android.exoplayer2.PlaybackPreparer
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.RenderersFactory
;
import
com.google.android.exoplayer2.RenderersFactory
;
import
com.google.android.exoplayer2.SimpleExoPlayer
;
import
com.google.android.exoplayer2.SimpleExoPlayer
;
...
@@ -69,7 +68,7 @@ import java.util.List;
...
@@ -69,7 +68,7 @@ import java.util.List;
/** An activity that plays media using {@link SimpleExoPlayer}. */
/** An activity that plays media using {@link SimpleExoPlayer}. */
public
class
PlayerActivity
extends
AppCompatActivity
public
class
PlayerActivity
extends
AppCompatActivity
implements
OnClickListener
,
PlaybackPreparer
,
StyledPlayerControlView
.
VisibilityListener
{
implements
OnClickListener
,
StyledPlayerControlView
.
VisibilityListener
{
// Saved instance state keys.
// Saved instance state keys.
...
@@ -252,13 +251,6 @@ public class PlayerActivity extends AppCompatActivity
...
@@ -252,13 +251,6 @@ public class PlayerActivity extends AppCompatActivity
}
}
}
}
// PlaybackPreparer implementation
@Override
public
void
preparePlayback
()
{
player
.
prepare
();
}
// PlayerControlView.VisibilityListener implementation
// PlayerControlView.VisibilityListener implementation
@Override
@Override
...
@@ -304,7 +296,6 @@ public class PlayerActivity extends AppCompatActivity
...
@@ -304,7 +296,6 @@ public class PlayerActivity extends AppCompatActivity
player
.
setAudioAttributes
(
AudioAttributes
.
DEFAULT
,
/* handleAudioFocus= */
true
);
player
.
setAudioAttributes
(
AudioAttributes
.
DEFAULT
,
/* handleAudioFocus= */
true
);
player
.
setPlayWhenReady
(
startAutoPlay
);
player
.
setPlayWhenReady
(
startAutoPlay
);
playerView
.
setPlayer
(
player
);
playerView
.
setPlayer
(
player
);
playerView
.
setPlaybackPreparer
(
this
);
debugViewHelper
=
new
DebugTextViewHelper
(
player
,
debugTextView
);
debugViewHelper
=
new
DebugTextViewHelper
(
player
,
debugTextView
);
debugViewHelper
.
start
();
debugViewHelper
.
start
();
}
}
...
...
extensions/leanback/src/main/java/com/google/android/exoplayer2/ext/leanback/LeanbackPlayerAdapter.java
View file @
11b09dd5
...
@@ -78,10 +78,15 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
...
@@ -78,10 +78,15 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
}
}
/**
/**
* Sets the {@link PlaybackPreparer}.
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The adapter calls
*
* {@link ControlDispatcher#dispatchPrepare(Player)} instead of {@link
* @param playbackPreparer The {@link PlaybackPreparer}.
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that the adapter
* uses by default, calls {@link Player#prepare()}. If you wish to customize this behaviour,
* you can provide a custom implementation of {@link
* ControlDispatcher#dispatchPrepare(Player)}.
*/
*/
@SuppressWarnings
(
"deprecation"
)
@Deprecated
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
this
.
playbackPreparer
=
playbackPreparer
;
this
.
playbackPreparer
=
playbackPreparer
;
}
}
...
@@ -167,11 +172,15 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
...
@@ -167,11 +172,15 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
return
player
.
getPlaybackState
()
==
Player
.
STATE_IDLE
?
-
1
:
player
.
getCurrentPosition
();
return
player
.
getPlaybackState
()
==
Player
.
STATE_IDLE
?
-
1
:
player
.
getCurrentPosition
();
}
}
// Calls deprecated method to provide backwards compatibility.
@SuppressWarnings
(
"deprecation"
)
@Override
@Override
public
void
play
()
{
public
void
play
()
{
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_IDLE
)
{
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_IDLE
)
{
if
(
playbackPreparer
!=
null
)
{
if
(
playbackPreparer
!=
null
)
{
playbackPreparer
.
preparePlayback
();
playbackPreparer
.
preparePlayback
();
}
else
{
controlDispatcher
.
dispatchPrepare
(
player
);
}
}
}
else
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_ENDED
)
{
}
else
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_ENDED
)
{
controlDispatcher
.
dispatchSeekTo
(
player
,
player
.
getCurrentWindowIndex
(),
C
.
TIME_UNSET
);
controlDispatcher
.
dispatchSeekTo
(
player
,
player
.
getCurrentWindowIndex
(),
C
.
TIME_UNSET
);
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java
View file @
11b09dd5
...
@@ -1147,6 +1147,8 @@ public final class MediaSessionConnector {
...
@@ -1147,6 +1147,8 @@ public final class MediaSessionConnector {
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_IDLE
)
{
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_IDLE
)
{
if
(
playbackPreparer
!=
null
)
{
if
(
playbackPreparer
!=
null
)
{
playbackPreparer
.
onPrepare
(
/* playWhenReady= */
true
);
playbackPreparer
.
onPrepare
(
/* playWhenReady= */
true
);
}
else
{
controlDispatcher
.
dispatchPrepare
(
player
);
}
}
}
else
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_ENDED
)
{
}
else
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_ENDED
)
{
seekTo
(
player
,
player
.
getCurrentWindowIndex
(),
C
.
TIME_UNSET
);
seekTo
(
player
,
player
.
getCurrentWindowIndex
(),
C
.
TIME_UNSET
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/ControlDispatcher.java
View file @
11b09dd5
...
@@ -27,6 +27,14 @@ import com.google.android.exoplayer2.Player.RepeatMode;
...
@@ -27,6 +27,14 @@ import com.google.android.exoplayer2.Player.RepeatMode;
public
interface
ControlDispatcher
{
public
interface
ControlDispatcher
{
/**
/**
* Dispatches a {@link Player#prepare()} operation.
*
* @param player The {@link Player} to which the operation should be dispatched.
* @return True if the operation was dispatched. False if suppressed.
*/
boolean
dispatchPrepare
(
Player
player
);
/**
* Dispatches a {@link Player#setPlayWhenReady(boolean)} operation.
* Dispatches a {@link Player#setPlayWhenReady(boolean)} operation.
*
*
* @param player The {@link Player} to which the operation should be dispatched.
* @param player The {@link Player} to which the operation should be dispatched.
...
...
library/core/src/main/java/com/google/android/exoplayer2/DefaultControlDispatcher.java
View file @
11b09dd5
...
@@ -53,6 +53,12 @@ public class DefaultControlDispatcher implements ControlDispatcher {
...
@@ -53,6 +53,12 @@ public class DefaultControlDispatcher implements ControlDispatcher {
}
}
@Override
@Override
public
boolean
dispatchPrepare
(
Player
player
)
{
player
.
prepare
();
return
true
;
}
@Override
public
boolean
dispatchSetPlayWhenReady
(
Player
player
,
boolean
playWhenReady
)
{
public
boolean
dispatchSetPlayWhenReady
(
Player
player
,
boolean
playWhenReady
)
{
player
.
setPlayWhenReady
(
playWhenReady
);
player
.
setPlayWhenReady
(
playWhenReady
);
return
true
;
return
true
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/PlaybackPreparer.java
View file @
11b09dd5
...
@@ -15,9 +15,11 @@
...
@@ -15,9 +15,11 @@
*/
*/
package
com
.
google
.
android
.
exoplayer2
;
package
com
.
google
.
android
.
exoplayer2
;
/** Called to prepare a playback. */
/** @deprecated Use {@link ControlDispatcher} instead. */
@Deprecated
public
interface
PlaybackPreparer
{
public
interface
PlaybackPreparer
{
/** Called to prepare a playback. */
/** @deprecated Use {@link ControlDispatcher#dispatchPrepare(Player)} instead. */
@Deprecated
void
preparePlayback
();
void
preparePlayback
();
}
}
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java
View file @
11b09dd5
...
@@ -611,11 +611,15 @@ public class PlayerControlView extends FrameLayout {
...
@@ -611,11 +611,15 @@ public class PlayerControlView extends FrameLayout {
}
}
/**
/**
* Sets the {@link PlaybackPreparer}.
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The view calls {@link
*
* ControlDispatcher#dispatchPrepare(Player)} instead of {@link
* @param playbackPreparer The {@link PlaybackPreparer}, or null to remove the current playback
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that the view
* preparer.
* uses by default, calls {@link Player#prepare()}. If you wish to customize this behaviour,
* you can provide a custom implementation of {@link
* ControlDispatcher#dispatchPrepare(Player)}.
*/
*/
@SuppressWarnings
(
"deprecation"
)
@Deprecated
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
this
.
playbackPreparer
=
playbackPreparer
;
this
.
playbackPreparer
=
playbackPreparer
;
}
}
...
@@ -1254,11 +1258,14 @@ public class PlayerControlView extends FrameLayout {
...
@@ -1254,11 +1258,14 @@ public class PlayerControlView extends FrameLayout {
}
}
}
}
@SuppressWarnings
(
"deprecation"
)
private
void
dispatchPlay
(
Player
player
)
{
private
void
dispatchPlay
(
Player
player
)
{
@State
int
state
=
player
.
getPlaybackState
();
@State
int
state
=
player
.
getPlaybackState
();
if
(
state
==
Player
.
STATE_IDLE
)
{
if
(
state
==
Player
.
STATE_IDLE
)
{
if
(
playbackPreparer
!=
null
)
{
if
(
playbackPreparer
!=
null
)
{
playbackPreparer
.
preparePlayback
();
playbackPreparer
.
preparePlayback
();
}
else
{
controlDispatcher
.
dispatchPrepare
(
player
);
}
}
}
else
if
(
state
==
Player
.
STATE_ENDED
)
{
}
else
if
(
state
==
Player
.
STATE_ENDED
)
{
seekTo
(
player
,
player
.
getCurrentWindowIndex
(),
C
.
TIME_UNSET
);
seekTo
(
player
,
player
.
getCurrentWindowIndex
(),
C
.
TIME_UNSET
);
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java
View file @
11b09dd5
...
@@ -682,10 +682,16 @@ public class PlayerNotificationManager {
...
@@ -682,10 +682,16 @@ public class PlayerNotificationManager {
}
}
/**
/**
* Sets the {@link PlaybackPreparer}.
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The manager calls
*
* {@link ControlDispatcher#dispatchPrepare(Player)} instead of {@link
* @param playbackPreparer The {@link PlaybackPreparer}.
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that this manager
* uses by default, calls {@link Player#prepare()}. If you wish to intercept or customize this
* behaviour, you can provide a custom implementation of {@link
* ControlDispatcher#dispatchPrepare(Player)} and pass it to {@link
* #setControlDispatcher(ControlDispatcher)}.
*/
*/
@SuppressWarnings
(
"deprecation"
)
@Deprecated
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
this
.
playbackPreparer
=
playbackPreparer
;
this
.
playbackPreparer
=
playbackPreparer
;
}
}
...
@@ -1039,8 +1045,7 @@ public class PlayerNotificationManager {
...
@@ -1039,8 +1045,7 @@ public class PlayerNotificationManager {
@Nullable
NotificationCompat
.
Builder
builder
,
@Nullable
NotificationCompat
.
Builder
builder
,
boolean
ongoing
,
boolean
ongoing
,
@Nullable
Bitmap
largeIcon
)
{
@Nullable
Bitmap
largeIcon
)
{
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_IDLE
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_IDLE
&&
player
.
getCurrentTimeline
().
isEmpty
())
{
&&
(
player
.
getCurrentTimeline
().
isEmpty
()
||
playbackPreparer
==
null
))
{
builderActions
=
null
;
builderActions
=
null
;
return
null
;
return
null
;
}
}
...
@@ -1369,6 +1374,7 @@ public class PlayerNotificationManager {
...
@@ -1369,6 +1374,7 @@ public class PlayerNotificationManager {
private
class
NotificationBroadcastReceiver
extends
BroadcastReceiver
{
private
class
NotificationBroadcastReceiver
extends
BroadcastReceiver
{
@SuppressWarnings
(
"deprecation"
)
@Override
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
Player
player
=
PlayerNotificationManager
.
this
.
player
;
Player
player
=
PlayerNotificationManager
.
this
.
player
;
...
@@ -1382,6 +1388,8 @@ public class PlayerNotificationManager {
...
@@ -1382,6 +1388,8 @@ public class PlayerNotificationManager {
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_IDLE
)
{
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_IDLE
)
{
if
(
playbackPreparer
!=
null
)
{
if
(
playbackPreparer
!=
null
)
{
playbackPreparer
.
preparePlayback
();
playbackPreparer
.
preparePlayback
();
}
else
{
controlDispatcher
.
dispatchPrepare
(
player
);
}
}
}
else
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_ENDED
)
{
}
else
if
(
player
.
getPlaybackState
()
==
Player
.
STATE_ENDED
)
{
controlDispatcher
.
dispatchSeekTo
(
player
,
player
.
getCurrentWindowIndex
(),
C
.
TIME_UNSET
);
controlDispatcher
.
dispatchSeekTo
(
player
,
player
.
getCurrentWindowIndex
(),
C
.
TIME_UNSET
);
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
View file @
11b09dd5
...
@@ -983,11 +983,15 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
...
@@ -983,11 +983,15 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
}
}
/**
/**
* Sets the {@link PlaybackPreparer}.
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The view calls {@link
*
* ControlDispatcher#dispatchPrepare(Player)} instead of {@link
* @param playbackPreparer The {@link PlaybackPreparer}, or null to remove the current playback
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that the view
* preparer.
* uses by default, calls {@link Player#prepare()}. If you wish to customize this behaviour,
* you can provide a custom implementation of {@link
* ControlDispatcher#dispatchPrepare(Player)}.
*/
*/
@SuppressWarnings
(
"deprecation"
)
@Deprecated
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setPlaybackPreparer
(
playbackPreparer
);
controller
.
setPlaybackPreparer
(
playbackPreparer
);
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java
View file @
11b09dd5
...
@@ -834,11 +834,15 @@ public class StyledPlayerControlView extends FrameLayout {
...
@@ -834,11 +834,15 @@ public class StyledPlayerControlView extends FrameLayout {
}
}
/**
/**
* Sets the {@link PlaybackPreparer}.
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The view calls {@link
*
* ControlDispatcher#dispatchPrepare(Player)} instead of {@link
* @param playbackPreparer The {@link PlaybackPreparer}, or null to remove the current playback
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that the view
* preparer.
* uses by default, calls {@link Player#prepare()}. If you wish to customize this behaviour,
* you can provide a custom implementation of {@link
* ControlDispatcher#dispatchPrepare(Player)}.
*/
*/
@SuppressWarnings
(
"deprecation"
)
@Deprecated
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
this
.
playbackPreparer
=
playbackPreparer
;
this
.
playbackPreparer
=
playbackPreparer
;
}
}
...
@@ -1698,11 +1702,14 @@ public class StyledPlayerControlView extends FrameLayout {
...
@@ -1698,11 +1702,14 @@ public class StyledPlayerControlView extends FrameLayout {
}
}
}
}
@SuppressWarnings
(
"deprecation"
)
private
void
dispatchPlay
(
Player
player
)
{
private
void
dispatchPlay
(
Player
player
)
{
@State
int
state
=
player
.
getPlaybackState
();
@State
int
state
=
player
.
getPlaybackState
();
if
(
state
==
Player
.
STATE_IDLE
)
{
if
(
state
==
Player
.
STATE_IDLE
)
{
if
(
playbackPreparer
!=
null
)
{
if
(
playbackPreparer
!=
null
)
{
playbackPreparer
.
preparePlayback
();
playbackPreparer
.
preparePlayback
();
}
else
{
controlDispatcher
.
dispatchPrepare
(
player
);
}
}
}
else
if
(
state
==
Player
.
STATE_ENDED
)
{
}
else
if
(
state
==
Player
.
STATE_ENDED
)
{
seekTo
(
player
,
player
.
getCurrentWindowIndex
(),
C
.
TIME_UNSET
);
seekTo
(
player
,
player
.
getCurrentWindowIndex
(),
C
.
TIME_UNSET
);
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java
View file @
11b09dd5
...
@@ -45,6 +45,7 @@ import androidx.annotation.RequiresApi;
...
@@ -45,6 +45,7 @@ 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.ControlDispatcher
;
import
com.google.android.exoplayer2.DefaultControlDispatcher
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.ExoPlaybackException
;
import
com.google.android.exoplayer2.PlaybackPreparer
;
import
com.google.android.exoplayer2.PlaybackPreparer
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
...
@@ -978,11 +979,15 @@ public class StyledPlayerView extends FrameLayout implements AdsLoader.AdViewPro
...
@@ -978,11 +979,15 @@ public class StyledPlayerView extends FrameLayout implements AdsLoader.AdViewPro
}
}
/**
/**
* Sets the {@link PlaybackPreparer}.
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} instead. The view calls {@link
*
* ControlDispatcher#dispatchPrepare(Player)} instead of {@link
* @param playbackPreparer The {@link PlaybackPreparer}, or null to remove the current playback
* PlaybackPreparer#preparePlayback()}. The {@link DefaultControlDispatcher} that the view
* preparer.
* uses by default, calls {@link Player#prepare()}. If you wish to customize this behaviour,
* you can provide a custom implementation of {@link
* ControlDispatcher#dispatchPrepare(Player)}.
*/
*/
@SuppressWarnings
(
"deprecation"
)
@Deprecated
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
public
void
setPlaybackPreparer
(
@Nullable
PlaybackPreparer
playbackPreparer
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setPlaybackPreparer
(
playbackPreparer
);
controller
.
setPlaybackPreparer
(
playbackPreparer
);
...
...
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