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.

[BUG]: PlatformException thrown when trying playing local audio file.

See original GitHub issue

Flutter Sound Version :

  • FULL v8.1.1

  • Important: Result of the command : flutter pub deps | grep flutter_sound

|-- flutter_sound 8.1.1 | |-- flutter_sound_platform_interface 8.1.1 | |-- flutter_sound_web 8.1.1 | | |-- flutter_sound_platform_interface…


Severity

  • Result is not what expected

Platforms you faced the error

  • Real iOS 14.5.1 device

Describe the bug

I need to download a remote audio file for editing. I’m using ffmpeg to cut and modify this audio and then I’m using FlutterSound to play the results.

The problme is that a PlatformException exception is thrown when I try to play the local .mp3 file that I downloaded. This exception only happens on a real device and not the emulator.

I was thinking that it could’ve been that I have two active players in the application but after changing to code to use only one the problem is still present. Remote audio files play just fine, the problem only appears when trying to play the file that I download. Once the problem appears the player fails to play remote or local files.

I’m using the following lines to play my audio files:

Future play(String filePath) {
  player.setSubscriptionDuration(_subscriptionHandler);
  return player.startPlayer(fromURI: filePath);
}

To Reproduce Steps to reproduce the behavior:

please allow give me a little bit of time to create a sample project that can reproduce this error.


Logs!!!

(This is very important. Most of the time we cannot do anything if we do not have information on your bug)


flutter: FS:---> setSubscriptionDuration
flutter: FS:---> startPlayer
IOS:--> setSubscriptionDuration
IOS:--> setSubscriptionDuration
IOS:<-- setSubscriptionDuration
IOS:<-- setSubscriptionDuration
flutter: FS:---> stop
IOS:--> stopPlayer
IOS:--> stopPlayer
IOS:--> stopTimer
IOS:<-- stopTimer
IOS:<-- stopPlayer
IOS:<-- stopPlayer - status = 0
flutter: FS:<---- setSubscriptionDuration
flutter: FS:---> channelMethodCallHandler : stopPlayerCompleted
flutter: ---> stopPlayerCompleted: true
flutter: <--- stopPlayerCompleted: true
flutter: FS:<--- channelMethodCallHandler : stopPlayerCompleted
flutter: FS:<--- stop
flutter: FS:---> _convert
flutter: FS:---> needToConvert
flutter: FS:<--- needToConvert
flutter: FS:<--- _convert
IOS:--> startPlayer
IOS:--> startPlayer
IOS:--> stopTimer
IOS:<-- stopTimer
IOS:--> stopTimer
IOS:<-- stopTimer
IOS: ![audioPlayer stop]
IOS:<-- startPlayer
IOS:<-- startPlayer
[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: PlatformException(Audio Player, startPlayer failure, null, null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:597:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
<asynchronous suspension>
#2      MethodChannelFlutterSoundPlayer.invokeMethod (package:flutter_sound_platform_interface/method_channel_flutter_sound_player.dart:184:12)
<asynchronous suspension>
#3      FlutterSoundPlayer._startPlayer (package:flutter_sound/public/flutter_sound_player.dart:1114:19)
<asynchronous suspension>
#4      FlutterSoundPlayer.startPlayer.<anonymous closure> (package:flutter_sound/public/flutter_sound_player.dart:1044:11)
<asynchronous suspension>
#5      BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33:16)
<asynchronous suspension>
#6      FlutterSoundPlayer.startPlayer (package:flutter_sound/public/flutter_sound_player.dart:1043:5)
<asynchronous suspension>

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

1reaction
bilalgodestocommented, Jun 15, 2021

I am also facing this issue. Is there any solution for this?

0reactions
huanliruicommented, Jan 27, 2022

How to play the local audio of the project. It’s like using local pictures ??

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to load asset: error when loading an .mp3 file Flutter
This tells Flutter that you have an audio folder in the root of your ... "assets/" in the path makes it play sounds...
Read more >
file_picker | Flutter Package - Pub.dev
A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support....
Read more >
dooboolab - Bountysource
I'm wondering if there's any way to pause / resume the audio recording. 0 likes. [BUG]: PlatformException thrown when trying playing local audio...
Read more >
platformexception(error, attempt to invoke interface method ...
equals(java.lang.Object)' on a null object reference, null) File "message_codecs.dart", line ...
Read more >
"Cannot play back the file. The format is not supported. (Error ...
One or more Windows Media Player files are missing or damaged. You are trying to play a media file that has a file...
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