mirror of
https://github.com/samsonjs/media.git
synced 2026-03-27 09:45:47 +00:00
Add player release check to enabling audio focus & audio becoming noisy handling.
PiperOrigin-RevId: 276679790
This commit is contained in:
parent
719a704dee
commit
ff82a13279
1 changed files with 8 additions and 0 deletions
|
|
@ -348,6 +348,7 @@ public class SimpleExoPlayer extends BasePlayer
|
|||
private boolean hasNotifiedFullWrongThreadWarning;
|
||||
@Nullable private PriorityTaskManager priorityTaskManager;
|
||||
private boolean isPriorityTaskManagerRegistered;
|
||||
private boolean playerReleased;
|
||||
|
||||
/**
|
||||
* @param context A {@link Context}.
|
||||
|
|
@ -641,6 +642,9 @@ public class SimpleExoPlayer extends BasePlayer
|
|||
@Override
|
||||
public void setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus) {
|
||||
verifyApplicationThread();
|
||||
if (playerReleased) {
|
||||
return;
|
||||
}
|
||||
if (!Util.areEqual(this.audioAttributes, audioAttributes)) {
|
||||
this.audioAttributes = audioAttributes;
|
||||
for (Renderer renderer : renderers) {
|
||||
|
|
@ -778,6 +782,9 @@ public class SimpleExoPlayer extends BasePlayer
|
|||
*/
|
||||
public void setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy) {
|
||||
verifyApplicationThread();
|
||||
if (playerReleased) {
|
||||
return;
|
||||
}
|
||||
audioBecomingNoisyManager.setEnabled(handleAudioBecomingNoisy);
|
||||
}
|
||||
|
||||
|
|
@ -1278,6 +1285,7 @@ public class SimpleExoPlayer extends BasePlayer
|
|||
}
|
||||
bandwidthMeter.removeEventListener(analyticsCollector);
|
||||
currentCues = Collections.emptyList();
|
||||
playerReleased = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue