I've made a radio app that works without any problems on Android 5 and above. The problem is: Multiple users have reported me that the app crashes on OnePlus devices, which is weird because on the same Android version but on a different device, it works without any problems.
I've managed to find a friend that has an OnePlus however he's from another country, so I can't get the device to debug. However, I've sent him a debug apk and he sent me this Image
My guess is that the problem starts here:
private void initializeMediaPlayer() {
player = new MediaPlayer();
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
player.setAudioAttributes(new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
.build());
} else {
player.setAudioStreamType(AudioManager.STREAM_MUSIC);
}
try {
player.setDataSource("http://91.121.139.194:8157/stream.mp3");
} catch (IOException e) {
e.printStackTrace();
}
}
Does OnePlus handle MediaPlayer in a different way? What could be the problem? I've looked for that error online but everything I found was about encoding the source which I've already done.
UPDATE: After some more debugging, we also found out the exact path to the Shoutcast MP3 file. After I've set the Data Source to the exact path, there are no errors. No logcat errors and no debug console errors... Yet it doesn't work.