-
Notifications
You must be signed in to change notification settings - Fork 251
Open
Description
Package version
^5.2.0
Environment
- OS: iOS
- Tested on airpods 3 and pro 2, iPhone 11
Describe the bug
When recording audio through headphones, no sound is produced. Instead, the following data is received:
[0, 8, 254, 232, 68, 0, 0, 0, 0, 0, 0, 0, ... zeros ..., 0].
To Reproduce
Steps to reproduce the behavior:
- Copy and paste the code
- Run the app on iOS
- Connect headphones (airpods)
- Press start and try to say something
- Press stop
- Disconnect headphones and try again
import 'package:flutter/material.dart';
import 'package:record/record.dart';
void main() {
runApp(_App());
}
class _App extends StatelessWidget {
const _App({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: _TestRecorder(),
);
}
}
class _TestRecorder extends StatefulWidget {
const _TestRecorder({super.key});
@override
State<_TestRecorder> createState() => _TestRecorderState();
}
class _TestRecorderState extends State<_TestRecorder> {
final _recorder = AudioRecorder();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () async {
final stream = await _recorder
.startStream(const RecordConfig(encoder: AudioEncoder.pcm16bits));
stream.listen((data) {
print('DATA: ${data.buffer.asUint8List()}');
});
},
child: const Text('START'),
),
ElevatedButton(
onPressed: () async {
await _recorder.stop();
},
child: const Text('STOP'),
),
],
),
),
);
}
}
Expected behavior
Audio should be recorded through the connected headphones.
kevsjh
Metadata
Metadata
Assignees
Labels
No labels