audioplayers
audioplayers copied to clipboard
iOS Error - Audio Cache - Audio causing entire app to lag/hang
I have verified this flutter plugin is causing the issue, as removing all audio calls have resolved the issue.
Full Description My app involves changing screens regularly, I am using Navigator.push and Navigator.pop, lots of button presses all with audio using this plugin. After a couple minutes of using the app it starts to lag and eventually freezes before continuing.
Code to Reproduce final player = AudioCache(); playClick() async { player.play('click.wav'); }
Log Errors "Error configuring audio session: Error Domain=NSOSStatusErrorDomain Code=2003329396 "(null)"" 2022-06-02 04:39:17.968175-0400 Runner[1305:456126] [default] CheckRPCError: AudioSessionSetProperty_Priv returned server mach error 0x10000003! "Error configuring audio session: Error Domain=NSOSStatusErrorDomain Code=2003329396 "(null)"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "iOS => call startHeadlessService, playerId cd52f66d-922e-4d38-986d-bb3e242812e8" "calling start headless service (\n "-6035574777829228503"\n)" "iOS => call play, playerId cd52f66d-922e-4d38-986d-bb3e242812e8" 2022-06-02 04:39:18.383775-0400 Runner[1305:456126] [default] AudioSessionSetProperty_Priv is passing a serverPID of 0 to CheckRPCError! "Error configuring audio session: Error Domain=NSOSStatusErrorDomain Code=1836282486 "(null)""
Platforms iOS 15, iPhone 13 Pro Max
-
OS: ios
-
OS version: 15
-
Device: iPhone 13 Pro Max PHYSICAL
-
flutter version: Flutter 2.10.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision 5464c5bac7 (6 weeks ago) • 2022-04-18 09:55:37 -0700 Engine • revision 57d3bac3dd Tools • Dart 2.16.2 • DevTools 2.9.2
-
audioplayers version: ^0.20.1
same problem here, massive lag and freeze
Same here with 0.20.1
, I tried upgrading to 1.0.0
but now the audio play only one time. Is there any updates ?
For context: I'm trying to play a sound on button click. If this button is clicked too many times in a fast way, the app start to lag and may crash on IOS.
Same here, 0.20.1
too, using it as dependency of flame_audio (which doesn't do a lot - it's just a wrapper).
Flutter 3.1.0-0.0.pre.1600 • channel master • https://github.com/flutter/flutter.git
Framework • revision 08457a3d7e (3 weeks ago) • 2022-07-11 13:25:07 -0400
Engine • revision 24a1b60e7f
Tools • Dart 2.18.0 (build 2.18.0-271.0.dev) • DevTools 2.15.0
Device: iPhone 11 Pro physical
From AVAudioSession.h:
typedef NS_ENUM(NSInteger, AVAudioSessionErrorCode)
{
...
-->**AVAudioSessionErrorCodeMediaServicesFailed**<-- = 'msrv', /* 0x6D737276, 1836282486 */
...
}
AVAudioSessionErrorCodeMediaServicesFailed:
An error code that indictates an attempt to use the audio session during or after a Media Services failure.
And as I understand, Media Services failure
may be this from OP's logs (I got the same):
2022-06-02 04:39:17.968175-0400 Runner[1305:456126] [default] CheckRPCError: AudioSessionSetProperty_Priv returned server mach error 0x10000003!
Now a bit more context for my case. How I use it:
_firstPrioritySfxPlayers[sfx] = AudioCache(...)
...
if (_firstPrioritySfxPlayers[sfx] == null || _firstPrioritySfxPlayers[sfx]!.state != PlayerState.PLAYING) {
_firstPrioritySfxPlayers[sfx]!.play(file, volume: volume, mode: PlayerMode.LOW_LATENCY);
}
I do not run sounds with the same source simultaneously (at least don't want), and for this case I have 6 different sounds.
Can you retest with audioplayers: ^1.1.0
?
Closing as stale.