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.

startPlayer() causes PlatformException

See original GitHub issue

Version of flutter_sound

1.4.8

flutter doctor

[√] Flutter (Channel stable, v1.9.1+hotfix.4, on Microsoft Windows [Versione 10.0.18362.388], locale it-IT)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [!] Android Studio (version 3.4) X Flutter plugin not installed; this adds Flutter specific functionality. X Dart plugin not installed; this adds Dart specific functionality. [√] VS Code (version 1.38.1) [√] VS Code, 64-bit edition [√] Connected device (1 available)

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

Android

Expected behavior

Play the audio file

Actual behavior

Gives PlatformException

Tested environment (Emulator? Real Device?)

Emulator

Steps to reproduce the behavior

This is my code:

void startPlayer() async { print(_filePath); String path = await flutterSound.startPlayer(_filePath); await flutterSound.setVolume(1.0); try { _playerSubscription = flutterSound.onPlayerStateChanged.listen((e) { if (e != null) { sliderCurrentPosition = e.currentPosition; maxDuration = e.duration; DateTime date = new DateTime.fromMillisecondsSinceEpoch( e.currentPosition.toInt(), ); String txt = DateFormat('mm:ss:SS', "it_IT").format(date); this.setState(() { this._playerTxt = txt.substring(0, 8); if (_isPlaying == false) { _isPlaying = true; } }); } else { this.setState(() { _isPlaying = false; }); } }); } catch (e) {} } It could be that the problem is the custom path that is passed as parameter in _flutterSound.startPlayer()? This is the exception when i press on the button that fire my callback startPlayer (code above):

[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Exception: PlatformException(ERR_UNKNOWN, ERR_UNKNOWN, Prepare failed.: status=0x1) E/flutter (15855): #0 FlutterSound.startPlayer package:flutter_sound/flutter_sound.dart:18

Tell me if I have to give you more info.

Issue Analytics

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

github_iconTop GitHub Comments

9reactions
alby97commented, Oct 6, 2019

I tried to reproduce the same issue on your example project and I found the “problem”, my file path contained colon and blank spaces, these caused the exception. So, I replaced them with underscore and now works properly in both project.

1reaction
lucygenericcommented, Apr 28, 2020

I tried to reproduce the same issue on your example project and I found the “problem”, my file path contained colon and blank spaces, these caused the exception. So, I replaced them with underscore and now works properly in both project.

This needs to be in the docs!

Read more comments on GitHub >

github_iconTop Results From Across the Web

startPlayer() causes PlatformException · Issue #140 - GitHub
Steps to reproduce the behavior. This is my code: void startPlayer() async { print(_filePath); String path = await flutterSound.startPlayer(_ ...
Read more >
flutter_sound 8.4.2 startPlayer() exception - Stack Overflow
the exception is platform exceptio error unknown startplayer() error,null . in the debug console I got these FlutterSoundPlayer.log ...
Read more >
[Solved]-flutter_sound 8.4.2 startPlayer() exception-Flutter
to play audios i use this library audioplayers: ^0.19.1 declare this variable to access audio. String audioCorrect = "audio/access_granted.mp3"; ...
Read more >
platformexception(multiple_request, cancelled by a second ...
Unhandled Exception: PlatformException(channel-error, Unable to establish ... @override _PageDescriptionState createState() => _PageDescriptionState(); } ...
Read more >
Java Telephony API Programmer's Reference
Provider is in this state. Applications may use the Provider.shutdown() method on this interface to cause a Provider to move into the Provider....
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