[BUG]: PlatformException thrown when trying playing local audio file.
See original GitHub issueFlutter 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:
- Created 2 years ago
- Reactions:3
- Comments:7
Top GitHub Comments
I am also facing this issue. Is there any solution for this?
How to play the local audio of the project. It’s like using local pictures ??