flame
flame copied to clipboard
Jitter on first play
FlameAudio.audioCache.loadAll(..) does not improve first play jitter
You have to play each of them with a volume of 0 to remove first play jitter
flame_audio: ^2.1.7
Flutter 3.16.8 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 67457e669f (3 weeks ago) • 2024-01-16 16:22:29 -0800
Engine • revision 6e2ea58a5c
Tools • Dart 3.2.5 • DevTools 2.28.5
import 'dart:developer';
import 'package:flame_audio/flame_audio.dart';
final $audio = AudioService();
class AudioService {
Future<void> setup() async {
final assets = ['tick.m4a'];
await FlameAudio.audioCache.loadAll(assets);
for (final x in assets) {
// this is required to remove drift on first play, loadAll isn't enough
FlameAudio.play(x, volume: 0);
}
log(name: 'audio', 'warmed up');
}
void playTick() => FlameAudio.play('tick.m4a');
}
Does this affect all platforms (part of the template you removed :wink:)?
@lukepighetti?
Closing this since there was no reply.