Skip to content

Commit 88a6930

Browse files
Frank Koenigsteinshazron
authored andcommitted
fix(android): java.lang.NullPointerException on resumeAllGainedFocus
This closes apache#122
1 parent cc4d641 commit 88a6930

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ Thumbs.db
1414

1515
node_modules
1616

17+
#eclipse
18+
bin
19+
.project
20+
.classpath
1721

1822

1923

2024

2125

22-
23-
26+

src/android/AudioHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ public void pauseAllLostFocus() {
411411

412412
public void resumeAllGainedFocus() {
413413
for (AudioPlayer audio : this.pausedForFocus) {
414-
audio.startPlaying(null);
414+
audio.resumePlaying();
415415
}
416416
this.pausedForFocus.clear();
417417
}

src/android/AudioPlayer.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,13 @@ public void stopPlaying() {
356356
}
357357
}
358358

359+
/**
360+
* Resume playing.
361+
*/
362+
public void resumePlaying() {
363+
this.startPlaying(this.audioFile);
364+
}
365+
359366
/**
360367
* Callback to be invoked when playback of a media source has completed.
361368
*
@@ -585,7 +592,7 @@ private boolean readyPlayer(String file) {
585592
//if we are readying the same file
586593
if (this.audioFile.compareTo(file) == 0) {
587594
//maybe it was recording?
588-
if(this.recorder!=null && player==null) {
595+
if (player == null) {
589596
this.player = new MediaPlayer();
590597
this.player.setOnErrorListener(this);
591598
this.prepareOnly = false;

0 commit comments

Comments
 (0)