flutter_sound 6.1.4
|-- flutter_sound 6.1.4
| |-- flutter_sound_platform_interface 1.0.0
Player won't play
(This is very important. Most of the time we cannot do anything if we do not have information on your bug):
Exception has occurred.
PlatformException (PlatformException(ERR_UNKNOWN, ERR_UNKNOWN, Prepare failed.: status=0x1))
E/flutter (23278): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: PlatformException(ERR_UNKNOWN, ERR_UNKNOWN, Prepare failed.: status=0x1)
E/flutter (23278): #0 StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:572
E/flutter (23278): #1 MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:161
E/flutter (23278): <asynchronous suspension>
E/flutter (23278): #2 MethodChannel.invokeMethod
package:flutter/…/services/platform_channel.dart:334
E/flutter (23278): #3 MethodChannelFlutterSoundPlayer.invokeMethod
package:flutter_sound_platform_interface/method_channel_flutter_sound_player.dart:168
E/flutter (23278): #4 MethodChannelFlutterSoundPlayer.startPlayer
package:flutter_sound_platform_interface/method_channel_flutter_sound_player.dart:237
E/flutter (23278): #5 FlutterSoundPlayer.startPlayer.<anonymous closure>
package:flutter_sound/src/flutter_sound_player.dart:551
E/flutter (23278): <asynchronous suspension>
E/flutter (23278): #6 FlutterSoundPlayer.startPlayer.<anonymous closure> (package:flutter_sound/src/flutter_sound_player.dart)
E/flutter (23278): #7 BasicLock.synchronized
package:synchronized/src/basic_lock.dart:32
E/flutter (23278): #8 FlutterSoundPlayer.startPlayer
package:flutter_sound/src/flutter_sound_player.dart:533
E/flutter (23278): #9 PlayerScreenState._play
[my file where I call "await _player.startPlayer(fromURI: url)"]
E/flutter (23278): <asynchronous suspension>
E/flutter (23278): #10 _PlayButton.build.<anonymous closure>
[my file where onPressed is defined for the playback button]
E/flutter (23278): #11 _InkResponseState._handleTap
package:flutter/…/material/ink_well.dart:992
E/flutter (23278): #12 _InkResponseState.build.<anonymous closure>
package:flutter/…/material/ink_well.dart:1098
E/flutter (23278): #13 GestureRecognizer.invokeCallback
package:flutter/…/gestures/recognizer.dart:184
E/flutter (23278): #14 TapGestureRecognizer.handleTapUp
package:flutter/…/gestures/tap.dart:524
E/flutter (23278): #15 BaseTapGestureRecognizer._checkUp
package:flutter/…/gestures/tap.dart:284
E/flutter (23278): #16 BaseTapGestureRecognizer.handlePrimaryPointer
package:flutter/…/gestures/tap.dart:219
E/flutter (23278): #17 PrimaryPointerGestureRecognizer.handleEvent
package:flutter/…/gestures/recognizer.dart:477
E/flutter (23278): #18 PointerRouter._dispatch
package:flutter/…/gestures/pointer_router.dart:78
E/flutter (23278): #19 PointerRouter._dispatchEventToRoutes.<anonymous closure>
package:flutter/…/gestures/pointer_router.dart:124
E/flutter (23278): #20 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8))
E/flutter (23278): #21 PointerRouter._dispatchEventToRoutes
package:flutter/…/gestures/pointer_router.dart:122
E/flutter (23278): #22 PointerRouter.route
package:flutter/…/gestures/pointer_router.dart:108
E/flutter (23278): #23 GestureBinding.handleEvent
package:flutter/…/gestures/binding.dart:220
E/flutter (23278): #24 GestureBinding.dispatchEvent
package:flutter/…/gestures/binding.dart:200
E/flutter (23278): #25 GestureBinding._handlePointerEvent
package:flutter/…/gestures/binding.dart:158
E/flutter (23278): #26 GestureBinding._flushPointerEventQueue
package:flutter/…/gestures/binding.dart:104
E/flutter (23278): #27 GestureBinding._handlePointerDataPacket
package:flutter/…/gestures/binding.dart:88
E/flutter (23278): #28 _rootRunUnary (dart:async/zone.dart:1206:13))
E/flutter (23278): #29 _CustomZone.runUnary (dart:async/zone.dart:1100:19))
E/flutter (23278): #30 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7))
E/flutter (23278): #31 _invoke1 (dart:ui/hooks.dart:267:10))
E/flutter (23278): #32 _dispatchPointerDataPacket (dart:ui/hooks.dart:176:5))
E/flutter (23278):
Describe the bug
My code worked with url's not containing colons or spaces but here I am using a url that contains a colon.
I saw a suggestion (comment https://github.com/dooboolab/flutter_sound/issues/140#issuecomment-538737638) to replace these characters with underscores but this did not work for me as the location of the colon character is in between the IP address and port number.
Format of URL I am using: "http://[IP_ADDRESS]:4001/[REST_OF_URL]". The rest of the url does not contain any colons or spaces.
Just to clarify I did try "http://[IP_ADDRESS]_4001/[REST_OF_URL]" but this did not work.
If this is not a bug and it is the intended outcome then please document this.
If there is no "real solution" to this problem then any work-around to this problem would be greatly appreciated.
Please let me know if there's any more information you need.
It seems like a bug in Flutter Sound.
"http://[IP_ADDRESS]:4001/[REST_OF_URL]"
is a perfect URL.
Which Codec do you pass to startPlayer() ?
Are you sure that this is the correct Codec that your URL point to ?
Which
Codecdo you pass tostartPlayer()?
Are you sure that this is the correct Codec that your URL point to ?
I did not explicitly pass a Codec parameter to startPlayer() but now I just did and I'm getting the same error.
The Codec I'm passing is Codec.mp3 and I am sure that this is the correct Codec that my URL is pointing too.
Does it work when you call this address from a Web Browser, on your Android device ?
Does it work when you call this address fro a Web Browser, on your Android device ?
Just tried and yes it does
Maybe a problem with the authorization missing for your App doing a call on port 4001.
I am not sure ...
Unfortunately I have not much time now to help you.
Maybe a problem with the authorization missing for your App doing a call on port 4001.
I am not sure ...Unfortunately I have not much time now to help you.
I will look into that. Thanks and please let me know if you think of anything else.
Sure.
Good luck
Is your URL pointing to a server doing Streaming ? Or this is just the address or a remote mp3 file ?
In other words : when you call your address from a Web Browser, does it play the song, or does it download your mp3 ?
In other words : when you call your address from a Web Browser, does it play the song, or does it download your mp3 ?
It plays the song
I managed to get it to work by adding android:usesCleartextTraffic="true" to the application tag in AndroidManifest.xml.
Found the solution here: https://github.com/flutter/flutter/issues/30368#issuecomment-480300618 if anyone needs more details.
Since this solves it I'm closing the issue.
Congratulations. You will probably save time to others developers 👍
Most helpful comment
I managed to get it to work by adding
android:usesCleartextTraffic="true"to theapplicationtag in AndroidManifest.xml.Found the solution here: https://github.com/flutter/flutter/issues/30368#issuecomment-480300618 if anyone needs more details.
Since this solves it I'm closing the issue.