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
2a287384
authored
Mar 28, 2022
by
ibaker
Committed by
Ian Baker
Apr 06, 2022
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add PlayerView to the stable API
PiperOrigin-RevId: 437777445
parent
0724e2b9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
5 deletions
libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java
libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java
View file @
2a287384
...
@@ -43,6 +43,7 @@ import android.view.ViewGroup;
...
@@ -43,6 +43,7 @@ import android.view.ViewGroup;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.annotation.ColorInt
;
import
androidx.annotation.IntDef
;
import
androidx.annotation.IntDef
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.RequiresApi
;
import
androidx.annotation.RequiresApi
;
...
@@ -168,30 +169,30 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
...
@@ -168,30 +169,30 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
* by drawables with the same names defined in your application. See the {@link PlayerControlView}
* by drawables with the same names defined in your application. See the {@link PlayerControlView}
* documentation for a list of drawables that can be overridden.
* documentation for a list of drawables that can be overridden.
*/
*/
@UnstableApi
public
class
PlayerView
extends
FrameLayout
implements
AdViewProvider
{
public
class
PlayerView
extends
FrameLayout
implements
AdViewProvider
{
/**
/**
* Determines when the buffering view is shown. One of {@link #SHOW_BUFFERING_NEVER}, {@link
* Determines when the buffering view is shown. One of {@link #SHOW_BUFFERING_NEVER}, {@link
* #SHOW_BUFFERING_WHEN_PLAYING} or {@link #SHOW_BUFFERING_ALWAYS}.
* #SHOW_BUFFERING_WHEN_PLAYING} or {@link #SHOW_BUFFERING_ALWAYS}.
*/
*/
@UnstableApi
@Documented
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
@Retention
(
RetentionPolicy
.
SOURCE
)
@Target
(
TYPE_USE
)
@Target
(
TYPE_USE
)
@IntDef
({
SHOW_BUFFERING_NEVER
,
SHOW_BUFFERING_WHEN_PLAYING
,
SHOW_BUFFERING_ALWAYS
})
@IntDef
({
SHOW_BUFFERING_NEVER
,
SHOW_BUFFERING_WHEN_PLAYING
,
SHOW_BUFFERING_ALWAYS
})
public
@interface
ShowBuffering
{}
public
@interface
ShowBuffering
{}
/** The buffering view is never shown. */
/** The buffering view is never shown. */
public
static
final
int
SHOW_BUFFERING_NEVER
=
0
;
@UnstableApi
public
static
final
int
SHOW_BUFFERING_NEVER
=
0
;
/**
/**
* The buffering view is shown when the player is in the {@link Player#STATE_BUFFERING buffering}
* The buffering view is shown when the player is in the {@link Player#STATE_BUFFERING buffering}
* state and {@link Player#getPlayWhenReady() playWhenReady} is {@code true}.
* state and {@link Player#getPlayWhenReady() playWhenReady} is {@code true}.
*/
*/
public
static
final
int
SHOW_BUFFERING_WHEN_PLAYING
=
1
;
@UnstableApi
public
static
final
int
SHOW_BUFFERING_WHEN_PLAYING
=
1
;
/**
/**
* The buffering view is always shown when the player is in the {@link Player#STATE_BUFFERING
* The buffering view is always shown when the player is in the {@link Player#STATE_BUFFERING
* buffering} state.
* buffering} state.
*/
*/
public
static
final
int
SHOW_BUFFERING_ALWAYS
=
2
;
@UnstableApi
public
static
final
int
SHOW_BUFFERING_ALWAYS
=
2
;
private
static
final
int
SURFACE_TYPE_NONE
=
0
;
private
static
final
int
SURFACE_TYPE_NONE
=
0
;
private
static
final
int
SURFACE_TYPE_SURFACE_VIEW
=
1
;
private
static
final
int
SURFACE_TYPE_SURFACE_VIEW
=
1
;
...
@@ -444,6 +445,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -444,6 +445,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @param oldPlayerView The old view to detach from the player.
* @param oldPlayerView The old view to detach from the player.
* @param newPlayerView The new view to attach to the player.
* @param newPlayerView The new view to attach to the player.
*/
*/
@UnstableApi
public
static
void
switchTargetView
(
public
static
void
switchTargetView
(
Player
player
,
@Nullable
PlayerView
oldPlayerView
,
@Nullable
PlayerView
newPlayerView
)
{
Player
player
,
@Nullable
PlayerView
oldPlayerView
,
@Nullable
PlayerView
newPlayerView
)
{
if
(
oldPlayerView
==
newPlayerView
)
{
if
(
oldPlayerView
==
newPlayerView
)
{
...
@@ -539,18 +541,21 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -539,18 +541,21 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param resizeMode The {@link ResizeMode}.
* @param resizeMode The {@link ResizeMode}.
*/
*/
@UnstableApi
public
void
setResizeMode
(
@ResizeMode
int
resizeMode
)
{
public
void
setResizeMode
(
@ResizeMode
int
resizeMode
)
{
Assertions
.
checkStateNotNull
(
contentFrame
);
Assertions
.
checkStateNotNull
(
contentFrame
);
contentFrame
.
setResizeMode
(
resizeMode
);
contentFrame
.
setResizeMode
(
resizeMode
);
}
}
/** Returns the {@link ResizeMode}. */
/** Returns the {@link ResizeMode}. */
@UnstableApi
public
@ResizeMode
int
getResizeMode
()
{
public
@ResizeMode
int
getResizeMode
()
{
Assertions
.
checkStateNotNull
(
contentFrame
);
Assertions
.
checkStateNotNull
(
contentFrame
);
return
contentFrame
.
getResizeMode
();
return
contentFrame
.
getResizeMode
();
}
}
/** Returns whether artwork is displayed if present in the media. */
/** Returns whether artwork is displayed if present in the media. */
@UnstableApi
public
boolean
getUseArtwork
()
{
public
boolean
getUseArtwork
()
{
return
useArtwork
;
return
useArtwork
;
}
}
...
@@ -560,6 +565,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -560,6 +565,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param useArtwork Whether artwork is displayed.
* @param useArtwork Whether artwork is displayed.
*/
*/
@UnstableApi
public
void
setUseArtwork
(
boolean
useArtwork
)
{
public
void
setUseArtwork
(
boolean
useArtwork
)
{
Assertions
.
checkState
(!
useArtwork
||
artworkView
!=
null
);
Assertions
.
checkState
(!
useArtwork
||
artworkView
!=
null
);
if
(
this
.
useArtwork
!=
useArtwork
)
{
if
(
this
.
useArtwork
!=
useArtwork
)
{
...
@@ -569,6 +575,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -569,6 +575,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
}
}
/** Returns the default artwork to display. */
/** Returns the default artwork to display. */
@UnstableApi
@Nullable
@Nullable
public
Drawable
getDefaultArtwork
()
{
public
Drawable
getDefaultArtwork
()
{
return
defaultArtwork
;
return
defaultArtwork
;
...
@@ -580,6 +587,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -580,6 +587,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param defaultArtwork the default artwork to display
* @param defaultArtwork the default artwork to display
*/
*/
@UnstableApi
public
void
setDefaultArtwork
(
@Nullable
Drawable
defaultArtwork
)
{
public
void
setDefaultArtwork
(
@Nullable
Drawable
defaultArtwork
)
{
if
(
this
.
defaultArtwork
!=
defaultArtwork
)
{
if
(
this
.
defaultArtwork
!=
defaultArtwork
)
{
this
.
defaultArtwork
=
defaultArtwork
;
this
.
defaultArtwork
=
defaultArtwork
;
...
@@ -588,6 +596,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -588,6 +596,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
}
}
/** Returns whether the playback controls can be shown. */
/** Returns whether the playback controls can be shown. */
@UnstableApi
public
boolean
getUseController
()
{
public
boolean
getUseController
()
{
return
useController
;
return
useController
;
}
}
...
@@ -601,6 +610,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -601,6 +610,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param useController Whether the playback controls can be shown.
* @param useController Whether the playback controls can be shown.
*/
*/
@UnstableApi
public
void
setUseController
(
boolean
useController
)
{
public
void
setUseController
(
boolean
useController
)
{
Assertions
.
checkState
(!
useController
||
controller
!=
null
);
Assertions
.
checkState
(!
useController
||
controller
!=
null
);
setClickable
(
useController
||
hasOnClickListeners
());
setClickable
(
useController
||
hasOnClickListeners
());
...
@@ -622,7 +632,8 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -622,7 +632,8 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param color The background color.
* @param color The background color.
*/
*/
public
void
setShutterBackgroundColor
(
int
color
)
{
@UnstableApi
public
void
setShutterBackgroundColor
(
@ColorInt
int
color
)
{
if
(
shutterView
!=
null
)
{
if
(
shutterView
!=
null
)
{
shutterView
.
setBackgroundColor
(
color
);
shutterView
.
setBackgroundColor
(
color
);
}
}
...
@@ -647,6 +658,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -647,6 +658,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @param keepContentOnPlayerReset Whether the currently displayed video frame or media artwork is
* @param keepContentOnPlayerReset Whether the currently displayed video frame or media artwork is
* kept visible when the player is reset.
* kept visible when the player is reset.
*/
*/
@UnstableApi
public
void
setKeepContentOnPlayerReset
(
boolean
keepContentOnPlayerReset
)
{
public
void
setKeepContentOnPlayerReset
(
boolean
keepContentOnPlayerReset
)
{
if
(
this
.
keepContentOnPlayerReset
!=
keepContentOnPlayerReset
)
{
if
(
this
.
keepContentOnPlayerReset
!=
keepContentOnPlayerReset
)
{
this
.
keepContentOnPlayerReset
=
keepContentOnPlayerReset
;
this
.
keepContentOnPlayerReset
=
keepContentOnPlayerReset
;
...
@@ -662,6 +674,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -662,6 +674,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* {@link #SHOW_BUFFERING_NEVER}, {@link #SHOW_BUFFERING_WHEN_PLAYING} and {@link
* {@link #SHOW_BUFFERING_NEVER}, {@link #SHOW_BUFFERING_WHEN_PLAYING} and {@link
* #SHOW_BUFFERING_ALWAYS}.
* #SHOW_BUFFERING_ALWAYS}.
*/
*/
@UnstableApi
public
void
setShowBuffering
(
@ShowBuffering
int
showBuffering
)
{
public
void
setShowBuffering
(
@ShowBuffering
int
showBuffering
)
{
if
(
this
.
showBuffering
!=
showBuffering
)
{
if
(
this
.
showBuffering
!=
showBuffering
)
{
this
.
showBuffering
=
showBuffering
;
this
.
showBuffering
=
showBuffering
;
...
@@ -674,6 +687,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -674,6 +687,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param errorMessageProvider The error message provider.
* @param errorMessageProvider The error message provider.
*/
*/
@UnstableApi
public
void
setErrorMessageProvider
(
public
void
setErrorMessageProvider
(
@Nullable
ErrorMessageProvider
<?
super
PlaybackException
>
errorMessageProvider
)
{
@Nullable
ErrorMessageProvider
<?
super
PlaybackException
>
errorMessageProvider
)
{
if
(
this
.
errorMessageProvider
!=
errorMessageProvider
)
{
if
(
this
.
errorMessageProvider
!=
errorMessageProvider
)
{
...
@@ -688,6 +702,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -688,6 +702,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param message The message to display, or {@code null} to clear a previously set message.
* @param message The message to display, or {@code null} to clear a previously set message.
*/
*/
@UnstableApi
public
void
setCustomErrorMessage
(
@Nullable
CharSequence
message
)
{
public
void
setCustomErrorMessage
(
@Nullable
CharSequence
message
)
{
Assertions
.
checkState
(
errorMessageView
!=
null
);
Assertions
.
checkState
(
errorMessageView
!=
null
);
customErrorMessage
=
message
;
customErrorMessage
=
message
;
...
@@ -725,11 +740,13 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -725,11 +740,13 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @param event A key event.
* @param event A key event.
* @return Whether the key event was handled.
* @return Whether the key event was handled.
*/
*/
@UnstableApi
public
boolean
dispatchMediaKeyEvent
(
KeyEvent
event
)
{
public
boolean
dispatchMediaKeyEvent
(
KeyEvent
event
)
{
return
useController
()
&&
controller
.
dispatchMediaKeyEvent
(
event
);
return
useController
()
&&
controller
.
dispatchMediaKeyEvent
(
event
);
}
}
/** Returns whether the controller is currently fully visible. */
/** Returns whether the controller is currently fully visible. */
@UnstableApi
public
boolean
isControllerFullyVisible
()
{
public
boolean
isControllerFullyVisible
()
{
return
controller
!=
null
&&
controller
.
isFullyVisible
();
return
controller
!=
null
&&
controller
.
isFullyVisible
();
}
}
...
@@ -741,11 +758,13 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -741,11 +758,13 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* #getControllerShowTimeoutMs()}}. They are shown indefinitely when playback has not started yet,
* #getControllerShowTimeoutMs()}}. They are shown indefinitely when playback has not started yet,
* is paused, has ended or failed.
* is paused, has ended or failed.
*/
*/
@UnstableApi
public
void
showController
()
{
public
void
showController
()
{
showController
(
shouldShowControllerIndefinitely
());
showController
(
shouldShowControllerIndefinitely
());
}
}
/** Hides the playback controls. Does nothing if playback controls are disabled. */
/** Hides the playback controls. Does nothing if playback controls are disabled. */
@UnstableApi
public
void
hideController
()
{
public
void
hideController
()
{
if
(
controller
!=
null
)
{
if
(
controller
!=
null
)
{
controller
.
hide
();
controller
.
hide
();
...
@@ -760,6 +779,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -760,6 +779,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @return The timeout in milliseconds. A non-positive value will cause the controller to remain
* @return The timeout in milliseconds. A non-positive value will cause the controller to remain
* visible indefinitely.
* visible indefinitely.
*/
*/
@UnstableApi
public
int
getControllerShowTimeoutMs
()
{
public
int
getControllerShowTimeoutMs
()
{
return
controllerShowTimeoutMs
;
return
controllerShowTimeoutMs
;
}
}
...
@@ -771,6 +791,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -771,6 +791,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @param controllerShowTimeoutMs The timeout in milliseconds. A non-positive value will cause the
* @param controllerShowTimeoutMs The timeout in milliseconds. A non-positive value will cause the
* controller to remain visible indefinitely.
* controller to remain visible indefinitely.
*/
*/
@UnstableApi
public
void
setControllerShowTimeoutMs
(
int
controllerShowTimeoutMs
)
{
public
void
setControllerShowTimeoutMs
(
int
controllerShowTimeoutMs
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
this
.
controllerShowTimeoutMs
=
controllerShowTimeoutMs
;
this
.
controllerShowTimeoutMs
=
controllerShowTimeoutMs
;
...
@@ -781,6 +802,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -781,6 +802,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
}
}
/** Returns whether the playback controls are hidden by touch events. */
/** Returns whether the playback controls are hidden by touch events. */
@UnstableApi
public
boolean
getControllerHideOnTouch
()
{
public
boolean
getControllerHideOnTouch
()
{
return
controllerHideOnTouch
;
return
controllerHideOnTouch
;
}
}
...
@@ -790,6 +812,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -790,6 +812,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param controllerHideOnTouch Whether the playback controls are hidden by touch events.
* @param controllerHideOnTouch Whether the playback controls are hidden by touch events.
*/
*/
@UnstableApi
public
void
setControllerHideOnTouch
(
boolean
controllerHideOnTouch
)
{
public
void
setControllerHideOnTouch
(
boolean
controllerHideOnTouch
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
this
.
controllerHideOnTouch
=
controllerHideOnTouch
;
this
.
controllerHideOnTouch
=
controllerHideOnTouch
;
...
@@ -801,6 +824,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -801,6 +824,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* ends, or fails. If set to false, the playback controls can be manually operated with {@link
* ends, or fails. If set to false, the playback controls can be manually operated with {@link
* #showController()} and {@link #hideController()}.
* #showController()} and {@link #hideController()}.
*/
*/
@UnstableApi
public
boolean
getControllerAutoShow
()
{
public
boolean
getControllerAutoShow
()
{
return
controllerAutoShow
;
return
controllerAutoShow
;
}
}
...
@@ -812,6 +836,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -812,6 +836,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param controllerAutoShow Whether the playback controls are allowed to show automatically.
* @param controllerAutoShow Whether the playback controls are allowed to show automatically.
*/
*/
@UnstableApi
public
void
setControllerAutoShow
(
boolean
controllerAutoShow
)
{
public
void
setControllerAutoShow
(
boolean
controllerAutoShow
)
{
this
.
controllerAutoShow
=
controllerAutoShow
;
this
.
controllerAutoShow
=
controllerAutoShow
;
}
}
...
@@ -822,6 +847,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -822,6 +847,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param controllerHideDuringAds Whether the playback controls are hidden when ads are playing.
* @param controllerHideDuringAds Whether the playback controls are hidden when ads are playing.
*/
*/
@UnstableApi
public
void
setControllerHideDuringAds
(
boolean
controllerHideDuringAds
)
{
public
void
setControllerHideDuringAds
(
boolean
controllerHideDuringAds
)
{
this
.
controllerHideDuringAds
=
controllerHideDuringAds
;
this
.
controllerHideDuringAds
=
controllerHideDuringAds
;
}
}
...
@@ -832,6 +858,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -832,6 +858,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @param listener The listener to be notified about visibility changes, or null to remove the
* @param listener The listener to be notified about visibility changes, or null to remove the
* current listener.
* current listener.
*/
*/
@UnstableApi
public
void
setControllerVisibilityListener
(
public
void
setControllerVisibilityListener
(
@Nullable
PlayerControlView
.
VisibilityListener
listener
)
{
@Nullable
PlayerControlView
.
VisibilityListener
listener
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
...
@@ -853,6 +880,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -853,6 +880,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @param listener The listener to be notified when the fullscreen button is clicked, or null to
* @param listener The listener to be notified when the fullscreen button is clicked, or null to
* remove the current listener and hide the fullscreen button.
* remove the current listener and hide the fullscreen button.
*/
*/
@UnstableApi
public
void
setControllerOnFullScreenModeChangedListener
(
public
void
setControllerOnFullScreenModeChangedListener
(
@Nullable
PlayerControlView
.
OnFullScreenModeChangedListener
listener
)
{
@Nullable
PlayerControlView
.
OnFullScreenModeChangedListener
listener
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
...
@@ -864,6 +892,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -864,6 +892,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param showRewindButton Whether the rewind button is shown.
* @param showRewindButton Whether the rewind button is shown.
*/
*/
@UnstableApi
public
void
setShowRewindButton
(
boolean
showRewindButton
)
{
public
void
setShowRewindButton
(
boolean
showRewindButton
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setShowRewindButton
(
showRewindButton
);
controller
.
setShowRewindButton
(
showRewindButton
);
...
@@ -874,6 +903,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -874,6 +903,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param showFastForwardButton Whether the fast forward button is shown.
* @param showFastForwardButton Whether the fast forward button is shown.
*/
*/
@UnstableApi
public
void
setShowFastForwardButton
(
boolean
showFastForwardButton
)
{
public
void
setShowFastForwardButton
(
boolean
showFastForwardButton
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setShowFastForwardButton
(
showFastForwardButton
);
controller
.
setShowFastForwardButton
(
showFastForwardButton
);
...
@@ -884,6 +914,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -884,6 +914,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param showPreviousButton Whether the previous button is shown.
* @param showPreviousButton Whether the previous button is shown.
*/
*/
@UnstableApi
public
void
setShowPreviousButton
(
boolean
showPreviousButton
)
{
public
void
setShowPreviousButton
(
boolean
showPreviousButton
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setShowPreviousButton
(
showPreviousButton
);
controller
.
setShowPreviousButton
(
showPreviousButton
);
...
@@ -894,6 +925,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -894,6 +925,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param showNextButton Whether the next button is shown.
* @param showNextButton Whether the next button is shown.
*/
*/
@UnstableApi
public
void
setShowNextButton
(
boolean
showNextButton
)
{
public
void
setShowNextButton
(
boolean
showNextButton
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setShowNextButton
(
showNextButton
);
controller
.
setShowNextButton
(
showNextButton
);
...
@@ -904,6 +936,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -904,6 +936,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param repeatToggleModes A set of {@link RepeatModeUtil.RepeatToggleModes}.
* @param repeatToggleModes A set of {@link RepeatModeUtil.RepeatToggleModes}.
*/
*/
@UnstableApi
public
void
setRepeatToggleModes
(
@RepeatModeUtil
.
RepeatToggleModes
int
repeatToggleModes
)
{
public
void
setRepeatToggleModes
(
@RepeatModeUtil
.
RepeatToggleModes
int
repeatToggleModes
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setRepeatToggleModes
(
repeatToggleModes
);
controller
.
setRepeatToggleModes
(
repeatToggleModes
);
...
@@ -914,6 +947,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -914,6 +947,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param showShuffleButton Whether the shuffle button is shown.
* @param showShuffleButton Whether the shuffle button is shown.
*/
*/
@UnstableApi
public
void
setShowShuffleButton
(
boolean
showShuffleButton
)
{
public
void
setShowShuffleButton
(
boolean
showShuffleButton
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setShowShuffleButton
(
showShuffleButton
);
controller
.
setShowShuffleButton
(
showShuffleButton
);
...
@@ -924,6 +958,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -924,6 +958,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param showSubtitleButton Whether the subtitle button is shown.
* @param showSubtitleButton Whether the subtitle button is shown.
*/
*/
@UnstableApi
public
void
setShowSubtitleButton
(
boolean
showSubtitleButton
)
{
public
void
setShowSubtitleButton
(
boolean
showSubtitleButton
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setShowSubtitleButton
(
showSubtitleButton
);
controller
.
setShowSubtitleButton
(
showSubtitleButton
);
...
@@ -934,6 +969,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -934,6 +969,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param showVrButton Whether the vr button is shown.
* @param showVrButton Whether the vr button is shown.
*/
*/
@UnstableApi
public
void
setShowVrButton
(
boolean
showVrButton
)
{
public
void
setShowVrButton
(
boolean
showVrButton
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setShowVrButton
(
showVrButton
);
controller
.
setShowVrButton
(
showVrButton
);
...
@@ -944,6 +980,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -944,6 +980,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
*
*
* @param showMultiWindowTimeBar Whether to show all windows.
* @param showMultiWindowTimeBar Whether to show all windows.
*/
*/
@UnstableApi
public
void
setShowMultiWindowTimeBar
(
boolean
showMultiWindowTimeBar
)
{
public
void
setShowMultiWindowTimeBar
(
boolean
showMultiWindowTimeBar
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
controller
.
setShowMultiWindowTimeBar
(
showMultiWindowTimeBar
);
controller
.
setShowMultiWindowTimeBar
(
showMultiWindowTimeBar
);
...
@@ -959,6 +996,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -959,6 +996,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @param extraPlayedAdGroups Whether each ad has been played, or {@code null} to show no extra ad
* @param extraPlayedAdGroups Whether each ad has been played, or {@code null} to show no extra ad
* markers.
* markers.
*/
*/
@UnstableApi
public
void
setExtraAdGroupMarkers
(
public
void
setExtraAdGroupMarkers
(
@Nullable
long
[]
extraAdGroupTimesMs
,
@Nullable
boolean
[]
extraPlayedAdGroups
)
{
@Nullable
long
[]
extraAdGroupTimesMs
,
@Nullable
boolean
[]
extraPlayedAdGroups
)
{
Assertions
.
checkStateNotNull
(
controller
);
Assertions
.
checkStateNotNull
(
controller
);
...
@@ -971,6 +1009,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -971,6 +1009,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @param listener The listener to be notified about aspect ratios changes of the video content or
* @param listener The listener to be notified about aspect ratios changes of the video content or
* the content frame.
* the content frame.
*/
*/
@UnstableApi
public
void
setAspectRatioListener
(
public
void
setAspectRatioListener
(
@Nullable
AspectRatioFrameLayout
.
AspectRatioListener
listener
)
{
@Nullable
AspectRatioFrameLayout
.
AspectRatioListener
listener
)
{
Assertions
.
checkStateNotNull
(
contentFrame
);
Assertions
.
checkStateNotNull
(
contentFrame
);
...
@@ -994,6 +1033,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -994,6 +1033,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @return The {@link SurfaceView}, {@link TextureView}, {@code SphericalGLSurfaceView}, {@code
* @return The {@link SurfaceView}, {@link TextureView}, {@code SphericalGLSurfaceView}, {@code
* VideoDecoderGLSurfaceView} or {@code null}.
* VideoDecoderGLSurfaceView} or {@code null}.
*/
*/
@UnstableApi
@Nullable
@Nullable
public
View
getVideoSurfaceView
()
{
public
View
getVideoSurfaceView
()
{
return
surfaceView
;
return
surfaceView
;
...
@@ -1006,6 +1046,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -1006,6 +1046,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @return The overlay {@link FrameLayout}, or {@code null} if the layout has been customized and
* @return The overlay {@link FrameLayout}, or {@code null} if the layout has been customized and
* the overlay is not present.
* the overlay is not present.
*/
*/
@UnstableApi
@Nullable
@Nullable
public
FrameLayout
getOverlayFrameLayout
()
{
public
FrameLayout
getOverlayFrameLayout
()
{
return
overlayFrameLayout
;
return
overlayFrameLayout
;
...
@@ -1017,6 +1058,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -1017,6 +1058,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @return The {@link SubtitleView}, or {@code null} if the layout has been customized and the
* @return The {@link SubtitleView}, or {@code null} if the layout has been customized and the
* subtitle view is not present.
* subtitle view is not present.
*/
*/
@UnstableApi
@Nullable
@Nullable
public
SubtitleView
getSubtitleView
()
{
public
SubtitleView
getSubtitleView
()
{
return
subtitleView
;
return
subtitleView
;
...
@@ -1070,6 +1112,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
...
@@ -1070,6 +1112,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
* @param contentFrame The content frame, or {@code null}.
* @param contentFrame The content frame, or {@code null}.
* @param aspectRatio The aspect ratio to apply.
* @param aspectRatio The aspect ratio to apply.
*/
*/
@UnstableApi
protected
void
onContentAspectRatioChanged
(
protected
void
onContentAspectRatioChanged
(
@Nullable
AspectRatioFrameLayout
contentFrame
,
float
aspectRatio
)
{
@Nullable
AspectRatioFrameLayout
contentFrame
,
float
aspectRatio
)
{
if
(
contentFrame
!=
null
)
{
if
(
contentFrame
!=
null
)
{
...
...
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