audio_waveforms
audio_waveforms copied to clipboard
Error while preparePlayer on ios 15.5 (using ios simulator not a real device)
audio_waveforms/AudioPlayer.swift:23: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSOSStatusErrorDomain Code=1685348671 "(null)" Lost connection to device.
Hello @khaled-muhammad We have tried to replicate the same issue with ios 15.5, and we cannot reproduce the same. Please recheck the same with our latest release and let us know if you still face the same?
version 0.1.3 on real device Device: iPhoneX iOS: 14.4.2
Problem scanning for packets
MPEGAudioFile::OpenFromDataSource failed
OpenFromDataSource failed
Open failed
Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSOSStatusErrorDomain Code=1685348671 "(null)": file audio_waveforms/AudioPlayer.swift, line 22
* thread #1, queue = 'com.apple.main-thread', stop reason = Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSOSStatusErrorDomain Code=1685348671 "(null)"
frame #0: 0x00000001997e9ff8 libswiftCore.dylib`_swift_runtime_on_report
libswiftCore.dylib`_swift_runtime_on_report:
-> 0x1997e9ff8 <+0>: ret
libswiftCore.dylib`_swift_reportToDebugger:
0x1997e9ffc <+0>: b 0x1997e9ff8 ; _swift_runtime_on_report
libswiftCore.dylib`_swift_shouldReportFatalErrorsToDebugger:
0x1997ea000 <+0>: adrp x8, 352372
0x1997ea004 <+4>: ldrb w0, [x8, #0x998]
Target 0: (Runner) stopped.
Lost connection to device.
Please help to fix this issue, thx. :)
version 0.1.3 on real device Device: iPhoneX iOS: 14.4.2
Problem scanning for packets MPEGAudioFile::OpenFromDataSource failed OpenFromDataSource failed Open failed Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSOSStatusErrorDomain Code=1685348671 "(null)": file audio_waveforms/AudioPlayer.swift, line 22 * thread #1, queue = 'com.apple.main-thread', stop reason = Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSOSStatusErrorDomain Code=1685348671 "(null)" frame #0: 0x00000001997e9ff8 libswiftCore.dylib`_swift_runtime_on_report libswiftCore.dylib`_swift_runtime_on_report: -> 0x1997e9ff8 <+0>: ret libswiftCore.dylib`_swift_reportToDebugger: 0x1997e9ffc <+0>: b 0x1997e9ff8 ; _swift_runtime_on_report libswiftCore.dylib`_swift_shouldReportFatalErrorsToDebugger: 0x1997ea000 <+0>: adrp x8, 352372 0x1997ea004 <+4>: ldrb w0, [x8, #0x998] Target 0: (Runner) stopped. Lost connection to device.
Please help to fix this issue, thx. :)
Problem solved.
Use 'test.m4a' instead of
File file = File('test.mp3');
@JeChingLin Can you please provide sample code for how you were trying to play the audio?
I have the same issue. It happens only when I record from Android and play the record on IOS.
@JeChingLin Any help please?
I have the same issue. It happens only when I record from Android and play the record on IOS.
@JeChingLin Any help please?
this is work for me.
Recorder
bool _isRecording = false;
late final RecorderController recorderController = RecorderController();
Future<void> _startRecord() async {
try {
if (await recorderController.checkPermission()) {
if (Platform.isAndroid) {
await recorderController.record();
} else {
appDirectory = await getTemporaryDirectory();
final file = File('${appDirectory.path}/record.m4a');
await recorderController.record(file.path);
}
setState(() {
_isRecording = recorderController.isRecording;
});
}
} catch (e) {
if (kDebugMode) {
print(e);
}
}
}
Player
late final PlayerController playerController;
late Directory appDirectory;
late PlayerState state = PlayerState.stopped;
@override
void initState() async {
super.initState();
appDirectory = await getTemporaryDirectory();
final file = File('${appDirectory.path}/tmp.m4a');
await file.writeAsBytes(widget.bytes);
try {
await playerController.preparePlayer(file.path);
setState(() {
state = playerController.playerState;
});
} catch (e) {
if (kDebugMode) {
print('player error: $e');
}
}
}
You shouldn't be facing the crash from 1.0.0
. the native initialization of the player was force unwrapped that's why it was throwing exception sometimes.
I'm going to close this issue for now but feel free to reopen or create a new issue.