Fix iOS playback: attach the Android-only audio effects only on Android
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
60506e730f
commit
5c304ec494
@ -4,6 +4,8 @@ import 'package:audio_service/audio_service.dart';
|
|||||||
import 'package:audio_session/audio_session.dart';
|
import 'package:audio_session/audio_session.dart';
|
||||||
import 'package:just_audio/just_audio.dart';
|
import 'package:just_audio/just_audio.dart';
|
||||||
|
|
||||||
|
import 'sound_settings.dart';
|
||||||
|
|
||||||
/// Owns the [AudioPlayer] and exposes it to the OS (lock screen, notification,
|
/// Owns the [AudioPlayer] and exposes it to the OS (lock screen, notification,
|
||||||
/// headset and Bluetooth buttons) through audio_service.
|
/// headset and Bluetooth buttons) through audio_service.
|
||||||
class NkAudioHandler extends BaseAudioHandler with SeekHandler {
|
class NkAudioHandler extends BaseAudioHandler with SeekHandler {
|
||||||
@ -15,8 +17,10 @@ class NkAudioHandler extends BaseAudioHandler with SeekHandler {
|
|||||||
final equalizer = AndroidEqualizer();
|
final equalizer = AndroidEqualizer();
|
||||||
final loudness = AndroidLoudnessEnhancer();
|
final loudness = AndroidLoudnessEnhancer();
|
||||||
|
|
||||||
|
// just_audio activates every effect in the pipeline on load, whatever the platform, and the
|
||||||
|
// Android effects throw on iOS, so attach them only on Android.
|
||||||
late final _player = AudioPlayer(
|
late final _player = AudioPlayer(
|
||||||
audioPipeline: AudioPipeline(androidAudioEffects: [loudness, equalizer]),
|
audioPipeline: AudioPipeline(androidAudioEffects: soundEffectsSupported ? [loudness, equalizer] : const []),
|
||||||
);
|
);
|
||||||
|
|
||||||
Stream<Duration> get positionStream => _player.positionStream;
|
Stream<Duration> get positionStream => _player.positionStream;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user