Recently I found myself in the office on a Saturday afternoon. It happens. (Deadlines don’t care, but you want your software to be good, yes. Just don’t do it too often. Especially don’t do it too often if you work for yourself.) We’re working in Xamarin, which I am still getting comfortable with, and to make it even more interesting, the bulk of the content of the app is being provided as React code that has to interact with the backend.
Anyway, one of the things I was getting grumpy about was a feature where you can preview a sound by selecting it from a picker. It had to work on both iOS and Android and the implementation used dependency injection. (Playing a sound is highly platform dependent so the code had to be implemented separately for both iOS and Android. The C# code in Xamarin then calls the appropriate method depending on the device. Very nifty.) It was working on Android devices and I wasn’t seeing any defect tickets on the issue, but it wasn’t working at all on my personal device. I had to track down the problem.
First I verified that the call from the javascript front end was making it into the back end. Then I verified that the code was retrieving the proper full path to the sound file in the app sandbox. All looked good. Run it in the simulator, there are no errors, and the sound plays. Run it in debug mode on the device, there are no errors, but no sound plays. Grr. I get a fresh cup of coffee and then do a quick search, suspicious that there might be something odd about the Xamarin code we’re using. And I find a post form someone back in 2015 who had the same issue. He had the mute button on his iPhone turned on.
The first time I got bit by this particular problem (because of course this wasn’t the first time, much to my chagrin), was back in 2011 when I was working on an educational app with video content. I don’t know if I felt more silly then or now. The truth is I’ve had this exact same issue about once every three years or so, just infrequently enough that I forget every time. Maybe next time I’ll remember how much I dislike noisy devices.
Whenever you’re working with audio content, don’t forget to check the mute button as well as the volume. In fact, if you’re working with audio content, I strongly suggest reading up on how your OS handles sound channels.
Which reminds me that I should take the time to read up on the specifics of how Android does it.