bluefireteam / audioplayers

A Flutter package to play multiple audio files simultaneously (Android/iOS/web/Linux/Windows/macOS)
https://pub.dartlang.org/packages/audioplayers
MIT License
1.98k stars 843 forks source link

E/MediaPlayerNative( 6767): error (1, -2147483648) #531

Closed pacifio closed 3 years ago

pacifio commented 4 years ago

Code

_player.play("https://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3");

Error

V/MediaHTTPService( 6767): MediaHTTPService(android.media.MediaHTTPService@d3e2288): Cookies: null
V/MediaHTTPService( 6767): makeHTTPConnection: CookieHandler (java.net.CookieManager@976f522) exists.
V/MediaHTTPService( 6767): makeHTTPConnection(android.media.MediaHTTPService@d3e2288): cookieHandler: java.net.CookieManager@976f522 Cookies: null
E/MediaPlayerNative( 6767): error (1, -2147483648)
E/MediaPlayer( 6767): Error (1,-2147483648)
E/MediaPlayerNative( 6767): stop called in state 0, mPlayer(0xcc47d040)
E/MediaPlayerNative( 6767): error (-38, 0)
V/MediaPlayer( 6767): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer( 6767): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaPlayer( 6767): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer( 6767): cleanDrmObj: mDrmObj=null mDrmSessionId=null

I even added usesCleartextTraffic in android manifest file

johnkorn commented 4 years ago

Hi! I have the same error but when running

final player = AudioCache();
player.play("note7.wav");

Have no idea what the problem is

Dan7s commented 4 years ago

Hello, I had exactly same issue, but flutter pub upgrade solve the problem. I was running version 1.13.5 of audioplayers.

johnkorn commented 4 years ago

yes, same worked for me, thanks

ElZombieIsra commented 4 years ago

I was having the same issue and none of the proposed solutions worked for me. Turns out the URL I was using was making some sort of redirection to the source so when the service tried to reach the source from the first URL all it got was an html with the redirection rule so thats what generated the issue for me. Try and see if the URL you are using is returning the audio file immediately or not

rayliverified commented 4 years ago

@ElZombieIsra is correct. If the URL provided is not a direct audio file, then this error occurs. This likely isn't a library error.

oSamDavis commented 3 years ago

Currently having the same issue. pub upgrade not working for me Screenshot (339)

braniii commented 3 years ago

Currently having the same issue. pub upgrade not working for me Screenshot (339)

I am using AudioCache to play every 10-60s a short sound, in .ogg format, of a few hundred milliseconds. It all works fine, but after a few minutes I always get the same error. I am on Android 9 together with the newest release 0.16.2

E/MediaPlayerNative(25640): error (1, -19)
E/MediaPlayer(25640): Error (1,-19)
E/MediaPlayerNative(25640): pause called in state 0, mPlayer(0x7101adfe3ec0)
E/MediaPlayerNative(25640): error (-38, 0)
E/MediaPlayerNative(25640): Attempt to perform seekTo in wrong state: mPlayer=0x7101adfe3ec0, mCurrentState=0
E/MediaPlayerNative(25640): error (-38, 0)
E/MediaPlayer(25640): Error (-38,0)
E/MediaPlayer(25640): Error (-38,0)
...
braniii commented 3 years ago

Using an fixed AudioPlayer instance seems to fix the problem for me. This works only, if the sounds do not overlap.

wael-fadlallah commented 3 years ago

@braniii am facing the same problem :( can you share with me how you create a fixed Audio player instance ?

claudehsu commented 3 years ago

Hi @wael-Fadlallah

I got the similar issue and creating the AudioCache instance with fixedPlayer named parameter resolved my issue.

AudioPlayer fixedPlayer = new AudioPlayer();
AudioCache player = AudioCache(fixedPlayer: fixedPlayer);
wael-fadlallah commented 3 years ago

Hey @claudehsu thanks for replaying I have try your fix but sadly I got some error after playing multiple tracks Unhandled Exception: PlatformException(Unexpected error!, Unable to access resource, java.lang.RuntimeException: Unable to access resource and then the player stop playing

mahdidham commented 3 years ago

seems like I have same issues here. Here's my log when try to play audio from url

...
W/System: ClassLoader referenced unknown path: system/framework/mediatek-cta.jar
I/System.out: [okhttp] e:java.lang.ClassNotFoundException: com.mediatek.cta.CtaUtils
I/System.out: [okhttp]:check permission begin!
W/System: ClassLoader referenced unknown path: system/framework/mediatek-cta.jar
[okhttp] e:java.lang.ClassNotFoundException: com.mediatek.cta.CtaUtils
I/System.out: [okhttp]:check permission begin!
W/System: ClassLoader referenced unknown path: system/framework/mediatek-cta.jar
I/System.out: [okhttp] e:java.lang.ClassNotFoundException: com.mediatek.cta.CtaUtils
E/MediaPlayerNative: error (1, -2147483648)
E/MediaPlayer: Error (1,-2147483648)

*edit, im adding another error that appears in my log

28308-28373 E/MediaPlayerNative: error (1, -2147483648)
28308-28308 E/MediaPlayer: Error (1,-2147483648)
28308-28308 E/MediaPlayerNative: stop called in state 0, mPlayer(0x895ee740)
28308-28308 E/MediaPlayerNative: error (-38, 0)
braniii commented 3 years ago

@braniii am facing the same problem :( can you share with me how you create a fixed Audio player instance ?

Sorry for the late reply. I am using following lines, but I am using only local files. With this snippet I am able to run a Tabata timer with 6-10 500ms sounds per minute for at least 40 minutes without any crash.

AudioPlayer audioPlayerInstance = AudioPlayer()..setReleaseMode(ReleaseMode.STOP);
AudioCache audioCache = AudioCache(fixedPlayer: audioPlayerInstance);
await audioCache.loadAll(<String>[...]);  // list with audio files
mahdidham commented 3 years ago

Just printing error in onPlayerError. I got this unknown error after AudioPlayerState turn to STOP

18413-18547 I/flutter: audioplayer error: MediaPlayer error with what:MEDIA_ERROR_UNKNOWN {what:1} extra:MEDIA_ERROR_SYSTEM
18413-18547 I/flutter: _platformCallHandler call audio.onComplete {value: true, playerId: ef0254f5-dde6-430c-bf30-a97f679ab2d7}

based from this issue #165 , there something with clearTextTraffic, but i already adding android:usesCleartextTraffic="true" INTERNET permission, etc, but it not work.

anyway, i am using latest audiopalyers (0.17.0), with android SDK 29

minikupa commented 3 years ago

same issue

itssidhere commented 3 years ago

Any updates on this?

mahdidham commented 3 years ago

ah, I almost forgot about this issue. So after deeply search, there is no issue for the code imo. In my case, the problem is from the API itself. After I check the headers of the API, the Content-Type is set to text/html, not audio/xwav. just try another open source audio url like this to check whether the function is work or not.

minikupa commented 3 years ago

I use the music in the assets folder, but the same error occurs. Same for other libraries

ElZombieIsra commented 3 years ago

Hey, everyone. I found myself encountering this error again today. The solution was the same I said before, the URL that I was using returned a redirect rule instead of the actual file.

Double-check if your URL is returning the actual file.

mahdidham commented 3 years ago

Consider to add human-readable error for this issue

nicolo-fr commented 3 years ago

Same issue here !
I try to play music in my assets folder. It works perfectly fine on the iPhone emulator, but I get this error when I try it on Android. Has anyone found a solution ? Thanks in advance for your help

E/MediaPlayerNative( 8001): error (1, -2147483648)
E/MediaPlayer( 8001): Error (1,-2147483648)
E/MediaPlayerNative( 8001): pause called in state 0, mPlayer(0xaf81bf70)
E/MediaPlayerNative( 8001): error (-38, 0)
E/MediaPlayerNative( 8001): Attempt to perform seekTo in wrong state: mPlayer=0xaf81bf70, mCurrentState=0
E/MediaPlayerNative( 8001): error (-38, 0)
luanpotter commented 3 years ago

@ElZombieIsra that is definitely the original issue, just by opening it on the browser you can see the real URL is:

https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_700KB.mp3

I should add this to the FAQ, seems to be a very common issue.

erickzanardo commented 3 years ago

@luanpotter did you added the FAQ entry so we can close this?

luanpotter commented 3 years ago

@erickzanardo how about: https://github.com/luanpotter/audioplayers/pull/845

pideltajah commented 3 years ago

I was getting the exact same error. My problem was I forgot to put the scheme in the audio URL. 🤦‍♂️ I tacked http:// to the front of it and solved the problem!

Nurtaz440 commented 3 years ago

2021-09-15 10:19:30.001 32611-32611/mening.dasturim.recyclerview E/im.recyclervie: Invalid ID 0x00000000. 2021-09-15 10:19:31.872 32611-2053/mening.dasturim.recyclerview E/MediaPlayerNative: error (1, -1015) 2021-09-15 10:19:31.875 32611-32611/mening.dasturim.recyclerview E/MediaPlayer: Error (1,-1015)

Ankit-Dhattarwal commented 1 year ago

Hi! I have the same error but when running

final player = AudioCache();
player.play("note7.wav");

Have no idea what the problem is

anyone can find solution for this plz tell me and i try ti find from last 1 week and not able to find any solution for this