bluefireteam / audioplayers

A Flutter package to play multiple audio files simultaneously (Android/iOS/web/Linux/Windows/macOS)
https://pub.dartlang.org/packages/audioplayers
MIT License
1.97k stars 838 forks source link

Doesn't work on WEB #1810

Open SzymonDziak opened 3 months ago

SzymonDziak commented 3 months ago

Checklist

Current bug behaviour

doesn't work on web after deployment. works on local.

Expected behaviour

to work

Steps to reproduce

  1. Execute flutter run on the code sample
  2. ...
  3. ...

Code sample

Code sample ```dart void main() { } ```

Affected platforms

web

Platform details

No response

AudioPlayers Version

latest

Build mode

release

Audio Files/URLs/Sources

No response

Screenshots

No response

Logs

my relevant logs
Full Logs ``` my full logs or a link to a gist ``` Flutter doctor: ``` Output of: flutter doctor -v ```

Related issues / more information

No response

Working on PR

no way

mussymakda commented 2 months ago

Checklist

  • [x] I read the troubleshooting guide before raising this issue
  • [x] I made sure that the issue I am raising doesn't already exist

Current bug behaviour

doesn't work on web after deployment. works on local.

Expected behaviour

to work

Steps to reproduce

  1. Execute flutter run on the code sample
  2. ...
  3. ...

Code sample

Code sample

Affected platforms

web

Platform details

No response

AudioPlayers Version

latest

Build mode

release

Audio Files/URLs/Sources

No response

Screenshots

No response

Logs

my relevant logs

Full Logs

Related issues / more information

No response

Working on PR

no way

facing the same issue please help

dvmatyun commented 2 months ago

This one helped me: (building with no-optimization flag). But you may try other flags as well flutter build web --web-renderer canvaskit --profile --dart-define=Dart2jsOptimization=O0

mussymakda commented 2 months ago

This one helped me: (building with no-optimization flag). But you may try other flags as well flutter build web --web-renderer canvaskit --profile --dart-define=Dart2jsOptimization=O0

not working even in debug web.. worked once but cannot reproduce the issue.

also works fine on android builds.

dvmatyun commented 2 months ago

This one helped me: (building with no-optimization flag). But you may try other flags as well flutter build web --web-renderer canvaskit --profile --dart-define=Dart2jsOptimization=O0

not working even in debug web.. worked once but cannot reproduce the issue.

also works fine on android builds.

hmmm, for me this code works:

    debugPrint(' > settings audio: ${audio.path} (bytes loaded)');
    final ulist = bytes.buffer.asUint8List();
    debugPrint(' > settings audio: ${audio.path} (ulist loaded)');
    await Future<void>.delayed(Duration.zero);
    final bytesSource = BytesSource(ulist);
    await player.player.setSource(bytesSource);

Result is here in my web flutter game after login https://make-world-strategy.web.app/