loonix / another_audio_recorder

(Null-Safe + V2) Audio Record Plugin that supports record, pause, resume, stop, and provide access to audio level metering properties average power peak power.
https://pub.dev/packages/another_audio_recorder
MIT License
5 stars 8 forks source link

in Ios this not work #11

Open dp77 opened 4 months ago

dp77 commented 4 months ago

IN iOS i get this error

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PathNotFoundException: Cannot copy file to '/var/mobile/Containers/Data/Application/9F2B9984-B1FC-495F-9A54-A915B817BEC7/Documents/recording_1717674447834.wav', path = '/var/mobile/Containers/Data/Application/9F2B9984-B1FC-495F-9A54-A915B817BEC7/Documents66618cc11d183d64ab2ec6391717674427138.wav' (OS Error: No such file or directory, errno = 2)

0 _checkForErrorResponse (dart:io/common.dart:55:9)

1 _File.copy. (dart:io/file_impl.dart:356:7)

#2 _MessageScreenState.sendMediaMessage (package:privacyport/ui/chat/message_screen.dart:1793:20) i give the permission also NSMicrophoneUsageDescription Can We Use Your Microphone Please This is my function void _initRecorder() async { if (await AnotherAudioRecorder.hasPermissions) { String customPath = chatId; Directory appDocDirectory; if (Platform.isIOS) { appDocDirectory = await getApplicationDocumentsDirectory(); } else { appDocDirectory = (await getExternalStorageDirectory())!; } customPath = appDocDirectory.path + customPath + DateTime.now().millisecondsSinceEpoch.toString(); _recorder = AnotherAudioRecorder(customPath, audioFormat: AudioFormat.WAV); await _recorder?.initialized; } else { print("Permissions not granted"); } } this is how i used this GestureDetector( onTap: () { if (newMessageController.text.isEmpty) return; if (group) { sendGroupMessage(); } else { sendMessage(); } }, onLongPress: () async { if (newMessageController.text.isEmpty) { animationController ..forward() ..repeat(reverse: true); await _recorder?.start(); } print('onLongPress'); }, onLongPressEnd: (details) { animationController.stop(); animationController.reset(); stopRecording(); print('onLongPressEnd'); }, child: AnimatedBuilder( animation: animationController, builder: (context, child) { return Transform.scale( scale: 1 + animationController.value * 0.5, // Adjust the scale factor as needed child: child, ); }, child: SizedBox( height: 45, width: 45, child: Image.asset( newMessageController.text.isEmpty ? VOICE : SEND, ), ), ), ),