audioplayers
audioplayers copied to clipboard
Low volume on iOS
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
After playing 1 sound more than once the volume is lowered to almost nothing. You need to max your volume to hear anything in the video. After first beep, there is more but very silent. Flutter SDK 3.19.5
https://github.com/bluefireteam/audioplayers/assets/26718209/68c0cc09-1da0-42e4-bb92-8be939516fb0
Expected behaviour
Volume should be always the same.
Steps to reproduce
- Execute
flutter run
on the code sample - Tap button multiple times
Code sample
Code sample
import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: AudioTestScreen(),
);
}
}
class AudioTestScreen extends StatefulWidget {
const AudioTestScreen({super.key});
@override
State<AudioTestScreen> createState() => _AudioTestScreenState();
}
class _AudioTestScreenState extends State<AudioTestScreen> {
late final AudioPlayer _player;
@override
void initState() {
super.initState();
_createAudioPlayer().then((value) => _player = value);
}
@override
void dispose() {
_player.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Material(
child: Center(
child: ElevatedButton(
onPressed: () async {
await _player.stop();
await _player.resume();
},
child: const Text('Play sound'),
),
),
);
}
Future<AudioPlayer> _createAudioPlayer() async {
final player = AudioPlayer(playerId: 'beep');
await player.setSourceAsset('beep.wav');
await player.setReleaseMode(ReleaseMode.stop);
await player.setAudioContext(AudioContext(
iOS: AudioContextIOS(
category: AVAudioSessionCategory.ambient,
),
));
await player.setPlayerMode(PlayerMode.lowLatency);
return player;
}
}
Affected platforms
iOS
Platform details
iOS 15.7.6 iPhone 6s
AudioPlayers Version
6.0.0
Build mode
debug, release
Audio Files/URLs/Sources
No response
Screenshots
No response
Logs
Launching lib/main.dart on Piotr’s iPhone in debug mode... Automatically signing iOS for device deployment using specified development team in Xcode project: ... Running Xcode build... Xcode build done. 7.7s Installing and launching... (lldb) 2024-05-14 13:50:44.490119+0200 Runner[2921:134882] [ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend. [ERROR:flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm(149)] Could not register as server for FlutterDartVMServicePublisher, permission denied. Check your 'Local Network' permissions for this app in the Privacy section of the system Settings. [ERROR:flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm(149)] Could not register as server for FlutterDartVMServicePublisher, permission denied. Check your 'Local Network' permissions for this app in the Privacy section of the system Settings. Debug service listening on ws://127.0.0.1:58697/osrPFwqs6Ps=/ws Syncing files to device Piotr’s iPhone... dnssd_clientstub read_all(14) DEFUNCT [ERROR:flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm(154)] Could not register as server for FlutterDartVMServicePublisher. Check your network settings and relaunch the application. dnssd_clientstub read_all(16) DEFUNCT [ERROR:flutter/shell/platform/darwin/ios/framework/Source/FlutterDartVMServicePublisher.mm(154)] Could not register as server for FlutterDartVMServicePublisher. Check your network settings and relaunch the application.
Related issues / more information
No response
Working on PR
no way