question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

startPlayerFromBuffer failure

See original GitHub issue

Version of flutter_sound

2.1.1

flutter doctor

[✓] Flutter (Channel dev, v1.15.3, on Linux, locale en_US.UTF-8)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [✓] Android Studio (version 3.6) [✓] VS Code (version 1.42.1) [✓] Connected device (1 available)

• No issues found!

Platforms you faced the error (IOS or Android or both?)

Android 9

Expected behavior

Play sound from a flutter asset.

Actual behavior

PlatformException(ERR_UNKNOWN, ERR_UNKNOWN, Prepare failed.: status=0x1)

Tested environment (Emulator? Real Device?)

Real device, Poco F1 with OmniROM

Steps to reproduce the behavior

I was trying to play an audio file from a small asset. The temporary file created in the Java backend is not world readable, so Android cannot prepare the playback session.

  Future<void> _playBeep(BuildContext context) async {
    final beep = await DefaultAssetBundle.of(context).load('assets/scanner_beep.ac3');
    final flutterSound = new FlutterSound();
    final playback = new Completer.sync();
    await flutterSound.startPlayerFromBuffer(beep.buffer.asUint8List(), codec: t_CODEC.CODEC_AAC);
    final subscription = flutterSound.onPlayerStateChanged.listen((event) {
      if (event == null) {
        return;
      }
      if (event.currentPosition == event.duration) {
        playback.complete();
      }
    });
    await playback.future;
    subscription.cancel();
  }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13

github_iconTop GitHub Comments

2reactions
wigy-opensource-developercommented, Jul 1, 2021

Sorry, I doubt I can help you in your problem. I made this experiment a year ago and I was not really happy with what I found about Android codec support and the specificity of error codes. If you are planning to integrate conversion into your application, the ffmpeg library is a good place to start with.

0reactions
jigarfumakiyacommented, Jul 12, 2021

Thanks for the info. @wigy-opensource-developer

Read more comments on GitHub >

github_iconTop Results From Across the Web

startPlayerFromBuffer failure · Issue #233 - GitHub
Play sound from a flutter asset. Actual behavior. PlatformException(ERR_UNKNOWN, ERR_UNKNOWN, Prepare failed.: status=0x1). Tested environment ( ...
Read more >
flutter_sound 7.6.4+2 | Flutter Package - Pub.dev
... if an App wants to play an asset file he must use "StartPlayerFromBuffer(). ... the audio channel, it can have problems with...
Read more >
What is the fastest way to start playing audio in QT application
First, invoking the QMediaPlayer with "LowLatency", is not meant for music, it is only for beeps, ringtones .. this is stated in QT ......
Read more >
Flutter Audio Player and Recorder - FlutterCore
Start player from buffer. For playing data from a memory buffer instead of a file, you can do the following : Uint8List buffer...
Read more >
[Solved]-How do i reproduce audio from List<int> in flutter?
... called startPlayerFromBuffer method https://pub.dev/packages/flutter_sound ... RenderFlex overflowed error only appears in the widget test, if i run the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found