Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public class RNStreamingKitManagerModule extends ReactContextBaseJavaModule impl
int _seekToTime = 0;

volatile boolean _isPaused;
volatile boolean _wasInterrupted;
volatile boolean _isBuffering;
AudioManager _audioManager;
;

public RNStreamingKitManagerModule(ReactApplicationContext reactContext) {
super(reactContext);
Expand Down Expand Up @@ -265,13 +265,21 @@ public void onAudioFocusChange(int focusChange) {
switch (focusChange) {
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
Log.d(NAME, "==> Audio Session Interruption case AUDIOFOCUS_LOSS_TRANSIENT.");
pause();
notifyAudioInterruption("interruptStart");

if (isMusicPlaying()) {
_wasInterrupted = true;
pause();
notifyAudioInterruption("interruptStart");
}

break;
case AudioManager.AUDIOFOCUS_GAIN:
Log.d(NAME, "==> Audio Session Interruption case AUDIOFOCUS_GAIN.");
resume();
notifyAudioInterruption("interruptEnd");
if (_wasInterrupted) {
_wasInterrupted = false;
resume();
notifyAudioInterruption("interruptEnd");
}
break;
case AudioManager.AUDIOFOCUS_LOSS:
//_audioManager.abandonAudioFocus(afChangeListener);
Expand Down