Repository navigation
Closed
Labels
help wantedExtra attention is needed
Description
I need Help for :
- Using the API ?
Here is my question : Hi, I'm a new flutter dev so this might be trivially answered...
I'm trying to use the quickplay class to play from a .wav file. I know the file is legit...and the app works otherwise, so here is the relevant piece of code:
var test_track = Track.fromAsset('assets/sound/track.wav');
QuickPlay.fromTrack(test_track);
I just call that when a button is pressed (the callback registered to onpressed has these 2 lines in it).
and the relevant part of my pubspec...
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/sounds/track.wav
And the stacktrace:
E/flutter (24392): [ERROR:flutter/lib/ui/ui_dart_state.cc(184)] Unhandled Exception: 'package:sounds/src/sound_player.dart': Failed assertion: line 309 pos 12: 'track != null': is not true.
E/flutter (24392): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
E/flutter (24392): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter (24392): #2 SoundPlayer.play (package:sounds/src/sound_player.dart:309:12)
E/flutter (24392): #3 QuickPlay._play (package:sounds/src/quick_play.dart:159:20)
E/flutter (24392): #4 new QuickPlay._internal (package:sounds/src/quick_play.dart:75:5)
E/flutter (24392): #5 new QuickPlay.fromTrack (package:sounds/src/quick_play.dart:62:15)
E/flutter (24392): #6 MyAppState.answerPrinter (package:flutter_complete_guide/main.dart:52:15)
E/flutter (24392): #7 MyAppState.build.<anonymous closure>.<anonymous closure> (package:flutter_complete_guide/main.dart:87:57)
E/flutter (24392): #8 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:991:20)
E/flutter (24392): #9 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:183:24)
E/flutter (24392): #10 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:598:11)
E/flutter (24392): #11 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:287:5)
E/flutter (24392): #12 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:222:7)
E/flutter (24392): #13 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:476:9)
E/flutter (24392): #14 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:93:12)
E/flutter (24392): #15 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:138:9)
E/flutter (24392): #16 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:387:8)
E/flutter (24392): #17 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:136:18)
E/flutter (24392): #18 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:122:7)
E/flutter (24392): #19 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:381:19)
E/flutter (24392): #20 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:361:22)
E/flutter (24392): #21 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:279:11)
E/flutter (24392): #22 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:316:7)
E/flutter (24392): #23 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:280:5)
E/flutter (24392): #24 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:238:7)
E/flutter (24392): #25 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:221:7)
E/flutter (24392): #26 _rootRunUnary (dart:async/zone.dart:1202:13)
E/flutter (24392): #27 _CustomZone.runUnary (dart:async/zone.dart:1097:19)
E/flutter (24392): #28 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1002:7)
E/flutter (24392): #29 _invoke1 (dart:ui/hooks.dart:176:10)
E/flutter (24392): #30 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:276:7)
E/flutter (24392): #31 _dispatchPointerDataPacket (dart:ui/hooks.dart:96:31)
...
E/flutter (24392): [ERROR:flutter/lib/ui/ui_dart_state.cc(184)] Unhandled Exception: PlatformException(ERR_PLAYER_IS_NULL, setVolume(), ERR_PLAYER_IS_NULL, null)
E/flutter (24392): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:582:7)
E/flutter (24392): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18)
E/flutter (24392): <asynchronous suspension>
E/flutter (24392): #2 PlayerBasePlugin.setVolume (package:sounds/src/plugins/player_base_plugin.dart:123:5)
E/flutter (24392): <asynchronous suspension>
E/flutter (24392): #3 SoundPlayer.setVolume.<anonymous closure> (package:sounds/src/sound_player.dart:450:7)
E/flutter (24392): <asynchronous suspension>
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is needed

Activity
RevanthRameshkumar commentedon Dec 31, 2020
Getting the same error when doing it w/ URL:
bsutton commentedon Jan 1, 2021
welcome to futter dev :)
First a bit of feedback.
When raising an issue you need to provide some more detail.
You need to provide enough information so the developer doesn't have to guess how to reproduce the problem.
For flutter you should at a minimum provide:
flutter version.
dart version
You should also try try to provide a minimal app that demonstrates the problem.
In this case I think you are using the 0.9.3 version. The beta has a fix for this issue.
jakub-trzebiatowski commentedon Feb 11, 2021
@bsutton But... it it like some corner case issue, or just does
QuickPlay.fromTracknot work at all? Because if that's the case, then it sounds (pun not intended) a bit like a stable channel deserves a backport, as it's been nearly two months since this issue was filed and beta is still in beta.jakub-trzebiatowski commentedon Feb 11, 2021
I also have this error:
Tested with both ^0.9.3 and ^1.0.0-beta13
jakub-trzebiatowski commentedon Feb 11, 2021
@bsutton I think you might be confused with how constructors work in Dart. In the following code:
...
QuickPlay._internal(volume, withShadeUI)is not constructor delegation of any kind, it's just an expression creating a new object of typeQuickPlay, using the_internalconstructor. The same applies tofromFileandfromBuffer, basically the whole class. My guess is thatQuickPlaynever worked at all.bsutton commentedon Feb 11, 2021
bsutton commentedon Mar 18, 2021
Released in 1.0.0