Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] QuickPlay failing due to assertion error #58

Closed
RevanthRameshkumar opened this issue Dec 31, 2020 · 7 comments
Closed

[HELP] QuickPlay failing due to assertion error #58

RevanthRameshkumar opened this issue Dec 31, 2020 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@RevanthRameshkumar
Copy link

RevanthRameshkumar commented Dec 31, 2020

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).

my dir structure for assets:
image

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>
@RevanthRameshkumar RevanthRameshkumar added the help wanted Extra attention is needed label Dec 31, 2020
@RevanthRameshkumar
Copy link
Author

Getting the same error when doing it w/ URL:

QuickPlay.fromURL('https://www2.cs.uic.edu/~i101/SoundFiles/ImperialMarch60.wav');

@bsutton
Copy link
Owner

bsutton commented 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.

@cubuspl42
Copy link

@bsutton But... it it like some corner case issue, or just does QuickPlay.fromTrack not 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.

@cubuspl42
Copy link

cubuspl42 commented Feb 11, 2021

I also have this error:

final track = Track.fromAsset(path);
QuickPlay.fromTrack(track);
I/flutter ( 8662): Uncaught asynchronous exception: 'package:sounds/src/sound_player.dart': Failed assertion: line 317 pos 12: 'track != null': is not true., stack trace:
I/flutter ( 8662):   dart:core-patch/errors_patch.dart 46:39                              _AssertionError._doThrowNew
I/flutter ( 8662):   dart:core-patch/errors_patch.dart 36:5                               _AssertionError._throwNew
I/flutter ( 8662):   package:sounds/src/sound_player.dart 317:12                          SoundPlayer.play
I/flutter ( 8662):   package:sounds/src/quick_play.dart 159:20                            QuickPlay._play
I/flutter ( 8662):   package:sounds/src/quick_play.dart 75:5                              new QuickPlay._internal
I/flutter ( 8662):   package:sounds/src/quick_play.dart 62:15                             new QuickPlay.fromTrack
I/flutter ( 8662):   package:lifepal_app/ui/routes/main_route/today/today_tab.dart 54:19  MainRouteTodo.build.play
I/flutter ( 8662):   package:lifepal_app/ui/routes/main_route/today/today_tab.dart 62:9   MainRouteTodo.build
I/flutter ( 8662):   package:flutter/src/widgets/framework.dart 4701:28                   StatelessElement.build
I/flutter ( 8662):   package:flutter_hooks/src/framework.dart 428:27                      HookElement.build

Tested with both ^0.9.3 and ^1.0.0-beta13

@cubuspl42
Copy link

@bsutton I think you might be confused with how constructors work in Dart. In the following code:

  QuickPlay.fromTrack(this._track,
      {double volume, bool withShadeUI = false, PlayerEvent onStopped})
      : _onStopped = onStopped {
    QuickPlay._internal(volume, withShadeUI);
  }

...QuickPlay._internal(volume, withShadeUI) is not constructor delegation of any kind, it's just an expression creating a new object of type QuickPlay, using the _internal constructor. The same applies to fromFile and fromBuffer, basically the whole class. My guess is that QuickPlay never worked at all.

@bsutton
Copy link
Owner

bsutton commented Feb 11, 2021 via email

@bsutton
Copy link
Owner

bsutton commented Mar 18, 2021

Released in 1.0.0

@bsutton bsutton closed this as completed Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants