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

On MacOS cannot stop recording #437

Open
HYC192 opened this issue Nov 18, 2024 · 3 comments
Open

On MacOS cannot stop recording #437

HYC192 opened this issue Nov 18, 2024 · 3 comments

Comments

@HYC192
Copy link

HYC192 commented Nov 18, 2024

Package version
record: ^5.2.0 (tried with 5.1.2 - same problem)

Environment

  • OS: MacOS
  • Device: MacOS.

Describe the bug

cannot stop recording,
final path = await RecordPlatform.instance.stop(_recorderId);
No response returned and always waiting

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'start record'
  2. Click on 'stop'

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

Thanks for reporting.
I was unable to reproduce it...
Please fill a reproducer.

@ajflubbe
Copy link

ajflubbe commented Jan 6, 2025

I have the exact same issue:, building for a macos app.
environment:
sdk: '>=3.2.1 <4.0.0'
dependencies:
flutter:
sdk: flutter
provider: ^6.0.3
flutter_bloc: ^8.1.6
cupertino_icons: ^1.0.2
record: ^5.2.0

I can get the list of devices, IsRecording and isEncoderSupported values. But as soon as I await for the path from .stop() I never get the result and the file is never written.

final path = await recorder.stop();
await recorder.dispose(); < --- Never gets executed
debugPrint("Path to file is $path"); < --- Never gets executed

I have used the debugger to step into the code and delve deep into the abyss but it becomes quite scary at some point when dealing with I got to platform_channel.dart..

Any advice or ideas for troubleshooting will be appreciated.

@ajflubbe
Copy link

ajflubbe commented Jan 6, 2025

I found a solution to this issue:

Its the fact that MacOs only allows access to certain folders when developing and the sandbox is used. I was writing the file to /tmp/out.m4a but it seems you can only write to specific folders

https://developer.apple.com/documentation/security/accessing-files-from-the-macos-app-sandbox

You can disable the sandbox as per
https://stackoverflow.com/questions/68114273/flutter-for-macos-how-to-access-user-selected-desktop-files-and-folders

Best practice would be to only write to folders your app has access to but for dev purposes disabling the sandbox should be find as long as you remember to fix your app before releasing it into the wild.

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

3 participants