Git Product home page Git Product logo

flame_audio's People

Contributors

erickzanardo avatar luanpotter avatar spydon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

flame_audio's Issues

BGM music keeps playing even after app is minimised

Hey after checking on discord .... it seems like this is a bug

Im working with the latest FlameAudio with flame rc5
BUT everytime I press HOME button, the BGM music keeps on playing. I have to knocked the app out via the task manager to kill the music.
It doesnt happen with the BACK button.... Only with the HOME button.
Any idea how to solve this?

Updating to audioplayers 0.19.0

I'm trying to use flame_audio to target builds to the web platform, which audioplayers v0.19.0 now supports. I want to help contribute to updating flame_audio to use audioplayers v0.19.0 dependency, but I'm encountering some issues along the lines of the 'package:audioplayers/audio_cache.dart' file missing and AudioPlayerState being undefined. I'll continue to tinker around, but would be far more happy to work alongside anyone on the team that may already have plans for supporting the web platform in the pipelines. Cheers!

Error on hot restart

The Issue

here's a simple flame game:

class MyGame extends BaseGame {
  Future<void> onLoad() async {
    super.onLoad();
    FlameAudio.bgm.initialize();
    FlameAudio.bgm.play('music/background.mp3', volume: 0.75);
  }
}

void main() {
  final BaseGame myGame = MyGame();
  runApp(
    GameWidget(
      game: myGame,
    ),
  );
}

when I start the app with flutter run and then type R in the terminal to hot restart, I get this error:

E/flutter (17559): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: LateInitializationError: Field '_channel@669020947' has been assigned during initialization.
E/flutter (17559): #0      AudioPlayer._channel (package:audioplayers/audioplayers.dart)
E/flutter (17559): #1      AudioPlayer._invokeMethod (package:audioplayers/audioplayers.dart:283:12)
E/flutter (17559): #2      AudioPlayer.setReleaseMode (package:audioplayers/audioplayers.dart:469:12)
E/flutter (17559): #3      AudioCache.loop (package:audioplayers/audio_cache.dart:178:12)
E/flutter (17559): <asynchronous suspension>
E/flutter (17559): #4      Bgm.play (package:flame_audio/bgm.dart:57:19)
E/flutter (17559): <asynchronous suspension>
E/flutter (17559): 

and the music stops

Environment

flutter doctor -v:

[✓] Flutter (Channel stable, 2.0.5, on macOS 11.3 20E5196f darwin-x64, locale en-US)
    • Flutter version 2.0.5 at /Users/suman/flutter
    • Framework revision adc687823a (13 days ago), 2021-04-16 09:40:20 -0700
    • Engine revision b09f014e96
    • Dart version 2.12.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/suman/Library/Android/sdk/
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.55.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (3 available)
    • Z3351S (mobile) • 320295556323 • android-arm    • Android 9 (API 28)
    • macOS (desktop) • macos        • darwin-x64     • macOS 11.3 20E5196f darwin-x64
    • Chrome (web)    • chrome       • web-javascript • Google Chrome 90.0.4430.93
    ! Error: Sumanth Ratna is not connected. Xcode will continue when Sumanth Ratna is connected. (code -13)

• No issues found!

Bgm.seek() and call backs???

Your example is really nice. But I have used the previous verion with flame.audio to gain info from call backs and listeners.
Im finding it very hard to get that implemented with this new version.
May be you could show us how...

let me give you an idea in the old version i could do something like
homeBGM.seek(Duration.zero);
or may be even something like this
homeBGM.onPlayerCompletion.listen((event) {

I found what i need at FlameAudio.bgm.audioPlayer

But im not able to do this with an audioPlayer.... Im able to handle regular stuff with only bgm:

  • Get the track to load from the asset into the audioPlayer
  • Make that track play from that audioPlayer
  • be able to reference that audioPlayer to use stuff like... start/stop/onPlayerCompletion etc etc

Would be great if you could show us how with this new version. Once again- Everything works in bgm via your example. But Im not able to get the required results if i follow the same steps for audioPlayer.
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.