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

unable to load asset #430

Closed
Lord-Cinders opened this issue Feb 18, 2020 · 2 comments
Closed

unable to load asset #430

Lord-Cinders opened this issue Feb 18, 2020 · 2 comments

Comments

@Lord-Cinders
Copy link

Lord-Cinders commented Feb 18, 2020

hello, I'm not able to play any audio using AudioCache.

here is my code:


AudioCache player = AudioCache(prefix: 'audio/');

                  player.play('Bruh-sound-effect.mp3');

here is my pubspec.yaml :

flutter:

  uses-material-design: true
  assets:
    - assets/images/PngItem_4931119.png
    - audio/movie_1.mp3
    - audio/Bruh-sound-effect.mp3

here is the error:`

E/flutter (11057): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Unable to load asset: assets/audio/Bruh-sound-effect.mp3
E/flutter (11057): #0      PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
E/flutter (11057): <asynchronous suspension>
E/flutter (11057): #1      AudioCache._fetchAsset (package:audioplayers/audio_cache.dart:59:29)
E/flutter (11057): #2      AudioCache.fetchToMemory (package:audioplayers/audio_cache.dart:66:30)
E/flutter (11057): <asynchronous suspension>
E/flutter (11057): #3      AudioCache.load (package:audioplayers/audio_cache.dart:81:37)
E/flutter (11057): #4      AudioCache.play (package:audioplayers/audio_cache.dart:102:23)
E/flutter (11057): #5      main.<anonymous closure> (package:bruh/main.dart:27:26)
E/flutter (11057): #6      _TapPositionDetectorState._postCallback (package:positioned_tap_detector/positioned_tap_detector.dart:124:15)
E/flutter (11057): #7      _TapPositionDetectorState._onTapEvent (package:positioned_tap_detector/positioned_tap_detector.dart:104:7)
E/flutter (11057): #8      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (11057): #9      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
E/flutter (11057): #10     BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
E/flutter (11057): #11     BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:236:7)
E/flutter (11057): #12     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter (11057): #13     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:222:20)
E/flutter (11057): #14     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (11057): #15     GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (11057): #16     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (11057): #17     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (11057): #18     _rootRunUnary (dart:async/zone.dart:1138:13)
E/flutter (11057): #19     _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter (11057): #20     _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7)
E/flutter (11057): #21     _invoke1 (dart:ui/hooks.dart:273:10)
E/flutter (11057): #22     _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)
@luanpotter
Copy link
Member

As per Flutter standard, all assets must be inside the assets folder. Your structure should be

assets/audio/movie_1.mp3

@Lord-Cinders
Copy link
Author

As per Flutter standard, all assets must be inside the assets folder. Your structure should be

assets/audio/movie_1.mp3

thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants