mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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;
|
private boolean hasNotifiedFullWrongThreadWarning;
|
||||||
@Nullable private PriorityTaskManager priorityTaskManager;
|
@Nullable private PriorityTaskManager priorityTaskManager;
|
||||||
private boolean isPriorityTaskManagerRegistered;
|
private boolean isPriorityTaskManagerRegistered;
|
||||||
|
private boolean playerReleased;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param context A {@link Context}.
|
* @param context A {@link Context}.
|
||||||
|
|
@ -641,6 +642,9 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
@Override
|
@Override
|
||||||
public void setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus) {
|
public void setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus) {
|
||||||
verifyApplicationThread();
|
verifyApplicationThread();
|
||||||
|
if (playerReleased) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!Util.areEqual(this.audioAttributes, audioAttributes)) {
|
if (!Util.areEqual(this.audioAttributes, audioAttributes)) {
|
||||||
this.audioAttributes = audioAttributes;
|
this.audioAttributes = audioAttributes;
|
||||||
for (Renderer renderer : renderers) {
|
for (Renderer renderer : renderers) {
|
||||||
|
|
@ -778,6 +782,9 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
*/
|
*/
|
||||||
public void setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy) {
|
public void setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy) {
|
||||||
verifyApplicationThread();
|
verifyApplicationThread();
|
||||||
|
if (playerReleased) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
audioBecomingNoisyManager.setEnabled(handleAudioBecomingNoisy);
|
audioBecomingNoisyManager.setEnabled(handleAudioBecomingNoisy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1278,6 +1285,7 @@ public class SimpleExoPlayer extends BasePlayer
|
||||||
}
|
}
|
||||||
bandwidthMeter.removeEventListener(analyticsCollector);
|
bandwidthMeter.removeEventListener(analyticsCollector);
|
||||||
currentCues = Collections.emptyList();
|
currentCues = Collections.emptyList();
|
||||||
|
playerReleased = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue