Audio difference between simulator and expo client

#1

Hi all,

I’ve been struggling to figure this out all week. I have 2 mp3s where one plays right after the other. The first one is 4 secs long and with the object singingBowlInstance, while the second is playbackInstance.

As you can see in this part of the code, when the first mp3 finishes the second one begins. This works fine on the IOS simulator - but on my iphone using the expo client, the first audio plays but not the second, or the second one is playing (per the console log on the object), but no sound is coming out.

Oddly, if I switch the stop and play statements it works. But I have no idea why I’m getting this difference between the simulator and the phone (note: I’m on a very fast network, so this isn’t about the mp3s not loading - I’ve checked that)

  this.singingBowlInstance.setOnPlaybackStatusUpdate(status => {

      if (status["didJustFinish"]) {
	 	this.singingBowlInstance.stopAsync();
     	   	this.playbackInstance.playAsync(); 
	 }
 });

Thanks for any insights you might have here.

0 Likes

#2

What happens if you await the stopAsync() and playAsync() calls so that they consistently happen sequentially? (Almost all functions that call into native are async and need to be await-ed for correctness.)

0 Likes

#3

Thanks…I did put await into both lines.

The real problem appears to be that with the android device, status[“didJustFinish”) doesn’t always work
Here is the output of the status and you can see the positionMillis gets to the point where it’s equal to durationMillis - but didJustFinished remains false. This doesn’t happen on an android emulator, or IOS (both emulators and devices.

Finally, the device I’m using is a Nexus 5 with Android version of 6.0.1

0 Likes