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
32b0474d
authored
Oct 14, 2019
by
olly
Committed by
Oliver Woodman
Oct 14, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Clean up playback suppression
PiperOrigin-RevId: 274561876
parent
0cda57aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
library/core/src/main/java/com/google/android/exoplayer2/Player.java
library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java
library/core/src/main/java/com/google/android/exoplayer2/Player.java
View file @
32b0474d
...
@@ -484,12 +484,15 @@ public interface Player {
...
@@ -484,12 +484,15 @@ public interface Player {
*/
*/
@Documented
@Documented
@Retention
(
RetentionPolicy
.
SOURCE
)
@Retention
(
RetentionPolicy
.
SOURCE
)
@IntDef
({
PLAYBACK_SUPPRESSION_REASON_NONE
,
PLAYBACK_SUPPRESSION_REASON_AUDIO_FOCUS_LOSS
})
@IntDef
({
PLAYBACK_SUPPRESSION_REASON_NONE
,
PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS
})
@interface
PlaybackSuppressionReason
{}
@interface
PlaybackSuppressionReason
{}
/** Playback is not suppressed. */
/** Playback is not suppressed. */
int
PLAYBACK_SUPPRESSION_REASON_NONE
=
0
;
int
PLAYBACK_SUPPRESSION_REASON_NONE
=
0
;
/** Playback is suppressed
because audio focus is lost or can't be acquired
. */
/** Playback is suppressed
due to transient audio focus loss
. */
int
PLAYBACK_SUPPRESSION_REASON_AUDIO_FOCUS_LOSS
=
1
;
int
PLAYBACK_SUPPRESSION_REASON_
TRANSIENT_
AUDIO_FOCUS_LOSS
=
1
;
/**
/**
* Repeat modes for playback. One of {@link #REPEAT_MODE_OFF}, {@link #REPEAT_MODE_ONE} or {@link
* Repeat modes for playback. One of {@link #REPEAT_MODE_OFF}, {@link #REPEAT_MODE_ONE} or {@link
...
@@ -617,13 +620,10 @@ public interface Player {
...
@@ -617,13 +620,10 @@ public interface Player {
int
getPlaybackState
();
int
getPlaybackState
();
/**
/**
* Returns reason why playback is suppressed even if {@link #getPlaybackState()} is {@link
* Returns the reason why playback is suppressed even though {@link #getPlayWhenReady()} is {@code
* #STATE_READY} and {@link #getPlayWhenReady()} is {@code true}.
* true}, or {@link #PLAYBACK_SUPPRESSION_REASON_NONE} if playback is not suppressed.
*
* <p>Note that {@link #PLAYBACK_SUPPRESSION_REASON_NONE} indicates that playback is not
* suppressed.
*
*
* @return The current {@link PlaybackSuppressionReason}.
* @return The current {@link PlaybackSuppressionReason
playback suppression reason
}.
*/
*/
@PlaybackSuppressionReason
@PlaybackSuppressionReason
int
getPlaybackSuppressionReason
();
int
getPlaybackSuppressionReason
();
...
...
library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java
View file @
32b0474d
...
@@ -1232,7 +1232,7 @@ public class SimpleExoPlayer extends BasePlayer
...
@@ -1232,7 +1232,7 @@ public class SimpleExoPlayer extends BasePlayer
@PlaybackSuppressionReason
@PlaybackSuppressionReason
int
playbackSuppressionReason
=
int
playbackSuppressionReason
=
playWhenReady
&&
playerCommand
!=
AudioFocusManager
.
PLAYER_COMMAND_PLAY_WHEN_READY
playWhenReady
&&
playerCommand
!=
AudioFocusManager
.
PLAYER_COMMAND_PLAY_WHEN_READY
?
Player
.
PLAYBACK_SUPPRESSION_REASON_AUDIO_FOCUS_LOSS
?
Player
.
PLAYBACK_SUPPRESSION_REASON_
TRANSIENT_
AUDIO_FOCUS_LOSS
:
Player
.
PLAYBACK_SUPPRESSION_REASON_NONE
;
:
Player
.
PLAYBACK_SUPPRESSION_REASON_NONE
;
player
.
setPlayWhenReady
(
playWhenReady
,
playbackSuppressionReason
);
player
.
setPlayWhenReady
(
playWhenReady
,
playbackSuppressionReason
);
}
}
...
...
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