0

I am playing an audio with audioplayers. Nonetheless, I get this error:

V/MediaPlayer(13566): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(13566): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaPlayer(13566): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(13566): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaPlayer(13566): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(13566): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaHTTPService(13566): MediaHTTPService(android.media.MediaHTTPService@5069e1b): Cookies: null
V/MediaHTTPService(13566): makeHTTPConnection: CookieHandler (java.net.CookieManager@f9da40) exists.
V/MediaHTTPService(13566): makeHTTPConnection(android.media.MediaHTTPService@5069e1b): cookieHandler: java.net.CookieManager@f9da40 Cookies: null

Soon after this appears on the screen:

E/flutter (13566): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: TimeoutException after 0:00:30.000000: Future not completed
E/flutter (13566):
E/MediaPlayerNative(13566): error (1, -2147483648)
E/MediaPlayer(13566): Error (1,-2147483648)
V/MediaPlayer(13566): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(13566): cleanDrmObj: mDrmObj=null mDrmSessionId=null
V/MediaPlayer(13566): resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
V/MediaPlayer(13566): cleanDrmObj: mDrmObj=null mDrmSessionId=null
I/flutter (13566): AudioPlayers Exception: AudioPlayerException(
I/flutter (13566):  UrlSource(url: https://file-examples.com/storage/fe1dbaea7664d369bb6e226/2017/11/file_example_MP3_700KB.mp3),
I/flutter (13566):  PlatformException(MEDIA_ERROR_UNKNOWN {what:1}, MEDIA_ERROR_SYSTEM, null, null)

And the code is simply a call to the audio's URL:

class MyWidget extends StatefulWidget {
  const MyWidget({super.key});

  @override
  State<MyWidget> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget> {

  @override
  void initState() {
    super.initState();

    AudioPlayer().play(UrlSource(
        "https://file-examples.com/storage/fe1dbaea7664d369bb6e226/2017/11/file_example_MP3_700KB.mp3"));
  }

  @override
  Widget build(BuildContext context) {
    return const Placeholder();
  }
}

What should I do to fix it? Where is the bug coming from?

I am using an Android emulator: Pixel 2 (R) API 30. Latest Dart, Flutter, and audioplayers versions.

Note: https://file-examples.com/storage/fe1dbaea7664d369bb6e226/2017/11/file_example_MP3_700KB.mp3 is the link for a random audio file I found on the Internet. Looking for more, the single same error happens, so it cannot be the source.

Antoniou
  • 131
  • 8
  • The examples at https://github.com/bluefireteam/audioplayers/blob/main/getting_started.md always show them using "await" when they call play(). Have you tried creating an async function that awaits the call to play() and call this new method from your initState method? – John Weidner Aug 10 '23 at 01:15
  • @JohnWeidner it cannot be. I've tried the Windows version and it works well. It must be something of Android since the message shows insights related to the cookies of the device. That's probably why there appears "android.media.MediaHTTPService". – Antoniou Aug 10 '23 at 20:31
  • Maybe it is the url of the file you are trying to play. I used your widget and the only thing I changed was the URL for the audio file and it worked. Here's the mp3 file I used - https://www.studystack.com/nicebeep.mp3 – John Weidner Aug 11 '23 at 00:28
  • It still doesn't work using that file. It seems to be something regarding audioplayers-android itself. I'll change to just_audio to see how it goes. – Antoniou Aug 11 '23 at 14:50
  • I see you were using an Android emulator of a Pixel 2 device. I was testing on a real Pixel 7 device. Maybe it has to do with the hardware. – John Weidner Aug 11 '23 at 15:41
  • Ahhh, man... I've changed to Pixel 4 API 29 with Q's android version but still the same error. I've changed to just_audio and it works fine, though. Thanks for your help! – Antoniou Aug 11 '23 at 16:12

0 Answers0