nstudio / nativescript-audio

:microphone: NativeScript plugin to record and play audio :musical_note:
Other
150 stars 104 forks source link

Error "extra": -2147483648 (Android 6) #143

Open Halynsky opened 5 years ago

Halynsky commented 5 years ago

Hello

I have an issue with Android API level used for build: 28 Android at device/emulator: 6

JS: NativeScript-Audio - TNSPlayer [audioPath, https://music-player-demo.herokuapp.com/assets/music/track.mp3] JS: NativeScript-Audio - TNSPlayer [android mediaPlayer is not initialized, creating new instance] JS: NativeScript-Audio - TNSPlayer [_mAudioFocusGranted, false] JS: NativeScript-Audio - TNSPlayer [resetting mediaPlayer...] JS: NativeScript-Audio - TNSPlayer [setting datasource, https://music-player-demo.herokuapp.com/assets/music/track.mp3] JS: NativeScript-Audio - TNSPlayer [preparing mediaPlayer async...] JS: NativeScript-Audio - TNSPlayer [errorCallback, 1] JS: { JS: "player": {}, JS: "error": 1, JS: "extra": -2147483648 JS: }

Meanwhile on device/emulator with Android 7+ all works fine. Android 6 is not supported?

Problem is that I can't debug it further because of very generic error information from plugin. In docs for Android MediaPlayer I have found that this description MEDIA_ERROR_SYSTEM (-2147483648) - low-level system error. But it can be anything.

Please explain to me how I can debug or find a real reason for this case. Or maybe it is some bug of plugin?

bradmartin commented 5 years ago

Hey @Halynsky - I've never debugged the low level android media errors myself.

It could be something with the plugin, maybe bad configuration, but honestly I'm not sure. The error codes leave much to be desired sometimes. Let me know if you find anything and I'd be happy to help or take a look when I find some time.

This SO Post has some decent info on the generic error.

Halynsky commented 5 years ago

Hi @bradmartin, thx for response. I have tried one real device and emulator both with Android 6. And I have got the same result in these cases. So maybe Android 6 is just not supported in the latest nativescript-audio. In this case, it is sad because a lot of people still use old Android distributives. Maybe the reason can be that I build an app with the latest version of Android API 9.0 API Level 28

bradmartin commented 5 years ago

The audio plugin is using the Android media player so I don't think the plugin itself would cause anything low level to go wrong. It's always possible, like you said, maybe something wrong in a specific Android SDK that your app is built with. Hard to say unfortunately.

joey0xx commented 5 years ago

Im having the same issue with an mp3 file hosted in an azure blob storage on an emulator with Android 9.0.0 and a device with Android 8.0.0.

pabloacastillo commented 4 years ago

I had this problem, solved it adding an attribute to the <application> tag in AndroidManifest.xml

android:usesCleartextTraffic="true"

And i have audio streaming on again.

Hope this helps.