Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File not saving after stopping the recording in linux #385

Closed
arxlan30 opened this issue Aug 23, 2024 · 2 comments
Closed

File not saving after stopping the recording in linux #385

arxlan30 opened this issue Aug 23, 2024 · 2 comments

Comments

@arxlan30
Copy link

Package version

Environment

  • OS: [Linux]
  • Browser [e.g. chrome, safari] if issue is on web platform.

Describe the bug

recording audio on linux desktop application but the issue is that when i stop recording its not saving the file. So I am unable to play the audio.

Add your record configuration RecordConfig(...)
record.start(const RecordConfig(), path: filePath,);

To Reproduce

void _startRecording() async {
setState(() {
_isRecording = true;
_recordDuration = 0;
});
String audioRecordId = DateTime.now().millisecondsSinceEpoch.toString();

String dir = (await getApplicationDocumentsDirectory()).path;
final String filePath = '$dir/$audioRecordId$audioExtension';

_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
  setState(() {
    _recordDuration++;
  });
});
await record.start(const RecordConfig(), path: filePath,);

}

void _stopRecording() async {
if (_timer != null) {
_timer!.cancel();
}

setState(() {
  _isRecording = false;
});
final path = await record.stop();
await record.cancel();

}

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Additional context

Add any other context about the problem here.

@llfbandit
Copy link
Owner

await record.cancel(); deletes the file...

@arxlan30
Copy link
Author

await record.cancel(); deletes the file...

Still not saving the file I am using your provided example. On stop its showing the path but this path has no audio file.
My OS is Ubuntu 22.04.3 LTS
I am building application for linux desktop.

file path I get onStop :/home/abc/audio_1724627047648.m4a

error if try to read the file
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PathNotFoundException: Cannot retrieve length of file, path = '/home/abc/audio_1724627047648.m4a' (OS Error: No such file or directory, errno = 2)
#0 _checkForErrorResponse (dart:io/common.dart:55:9)
#1 _File.length. (dart:io/file_impl.dart:389:7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants