flet
flet copied to clipboard
After building an application for macos, access to the microphone does not work
✅ Checked Issues ✅ Checked Stackoverflow
ℹ️ Description
After building the application for mac os, there is no access to the microphone. The operating system does not request it. As a result, the application cannot record audio. This does not work with ft.Audio Recorder(), or with any other libraries that work with audio
🤖Code example to reproduce the issue:
Here is a simple example program that describes the problem. There is only one button that calls await audio_rec.has_permission_async()
and the result is displayed in a text field
import flet as ft
async def main(page: ft.Page):
audio_rec = ft.AudioRecorder()
page.overlay.append(audio_rec)
permissions_text = ft.Text()
async def check_audio(e):
result = await audio_rec.has_permission_async()
string_result = f"Audio permissions: {result}"
permissions_text.value = string_result
await permissions_text.update_async()
print(string_result)
page.add(ft.ElevatedButton("Check Audio", on_click=check_audio), permissions_text)
ft.app(target=main)
⚠️ Actual result:
The app did not request access to the microphone "Audio permissions: False"
🥳 Expected result:
The application has requested access to the microphone and if it is allowed to use it, then audio recording through the microphone works
⭐️ Additional information:
After building the application, I tried adding the following lines to info.plist:
<key>NSMicrophoneUsageDescription</key>
<string>Please work</string>
But this did not help. Maybe there is a correct way to add this flag when building?
Flet version::
-
flet=0.22.0
-
Python version 3.11.6
Operating system:
- Macos M2
- Sonoma 14.4.1
Build command:
flet build macos --include-packages flet_audio_recorder