flet-audio-recorder 0.1.0.dev1__tar.gz → 0.2.0.dev18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. flet_audio_recorder-0.2.0.dev18/PKG-INFO +37 -0
  2. flet_audio_recorder-0.2.0.dev18/README.md +23 -0
  3. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/pyproject.toml +10 -1
  4. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flet_audio_recorder/audio_recorder.py +211 -3
  5. flet_audio_recorder-0.2.0.dev18/src/flet_audio_recorder.egg-info/PKG-INFO +37 -0
  6. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flutter/flet_audio_recorder/pubspec.lock +77 -77
  7. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flutter/flet_audio_recorder/pubspec.yaml +1 -1
  8. flet_audio_recorder-0.1.0.dev1/PKG-INFO +0 -93
  9. flet_audio_recorder-0.1.0.dev1/README.md +0 -79
  10. flet_audio_recorder-0.1.0.dev1/src/flet_audio_recorder.egg-info/PKG-INFO +0 -93
  11. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/setup.cfg +0 -0
  12. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flet_audio_recorder/__init__.py +0 -0
  13. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flet_audio_recorder.egg-info/SOURCES.txt +0 -0
  14. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flet_audio_recorder.egg-info/dependency_links.txt +0 -0
  15. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flet_audio_recorder.egg-info/requires.txt +0 -0
  16. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flet_audio_recorder.egg-info/top_level.txt +0 -0
  17. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flutter/flet_audio_recorder/CHANGELOG.md +0 -0
  18. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flutter/flet_audio_recorder/LICENSE +0 -0
  19. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flutter/flet_audio_recorder/README.md +0 -0
  20. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flutter/flet_audio_recorder/analysis_options.yaml +0 -0
  21. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flutter/flet_audio_recorder/lib/flet_audio_recorder.dart +0 -0
  22. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flutter/flet_audio_recorder/lib/src/audio_recorder.dart +0 -0
  23. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flutter/flet_audio_recorder/lib/src/create_control.dart +0 -0
  24. {flet_audio_recorder-0.1.0.dev1 → flet_audio_recorder-0.2.0.dev18}/src/flutter/flet_audio_recorder/lib/src/utils/audio_recorder.dart +0 -0
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.2
2
+ Name: flet-audio-recorder
3
+ Version: 0.2.0.dev18
4
+ Summary: AudioRecorder control for Flet
5
+ Author-email: Flet contributors <hello@flet.dev>
6
+ Project-URL: Homepage, https://flet.dev
7
+ Project-URL: Documentation, https://flet.dev/docs/controls/audiorecorder
8
+ Project-URL: Repository, https://github.com/flet-dev/flet-audio-recorder
9
+ Project-URL: Issues, https://github.com/flet-dev/flet-audio-recorder/issues
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: flet>=0.25.2
14
+
15
+ # AudioRecorder
16
+
17
+ Audio recorder from microphone to a given file path. Works on macOS, Linux, Windows, iOS, Android and web.
18
+ Based on the [record](https://pub.dev/packages/record) Dart/Flutter package.
19
+
20
+ **NOTE:** On Linux, encoding is provided by [fmedia](https://stsaz.github.io/fmedia/) which must be installed separately.
21
+
22
+ AudioRecorder control is non-visual and should be added to `page.overlay` list.
23
+
24
+ ## Installation
25
+
26
+ Add `flet-audio-recorder` as dependency to `pyproject.toml` of your Flet app:
27
+
28
+ ```
29
+ dependencies = [
30
+ "flet-audio-recorder",
31
+ "flet>=0.27.4",
32
+ ]
33
+ ```
34
+
35
+ ## Documentation
36
+
37
+ https://flet-dev.github.io/flet-audio-recorder/
@@ -0,0 +1,23 @@
1
+ # AudioRecorder
2
+
3
+ Audio recorder from microphone to a given file path. Works on macOS, Linux, Windows, iOS, Android and web.
4
+ Based on the [record](https://pub.dev/packages/record) Dart/Flutter package.
5
+
6
+ **NOTE:** On Linux, encoding is provided by [fmedia](https://stsaz.github.io/fmedia/) which must be installed separately.
7
+
8
+ AudioRecorder control is non-visual and should be added to `page.overlay` list.
9
+
10
+ ## Installation
11
+
12
+ Add `flet-audio-recorder` as dependency to `pyproject.toml` of your Flet app:
13
+
14
+ ```
15
+ dependencies = [
16
+ "flet-audio-recorder",
17
+ "flet>=0.27.4",
18
+ ]
19
+ ```
20
+
21
+ ## Documentation
22
+
23
+ https://flet-dev.github.io/flet-audio-recorder/
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flet-audio-recorder"
3
- version = "0.1.0.dev1"
3
+ version = "0.2.0.dev18"
4
4
  description = "AudioRecorder control for Flet"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -26,8 +26,17 @@ Issues = "https://github.com/flet-dev/flet-audio-recorder/issues"
26
26
  [tool.uv]
27
27
  dev-dependencies = [
28
28
  "flet[all]>=0.25.2",
29
+ "mkdocs",
30
+ "mkdocs-material",
31
+ "mkdocstrings[python]"
29
32
  ]
30
33
 
34
+ [tool.poetry.group.dev.dependencies]
35
+ flet = {extras = ["all"], version = "0.27.4"}
36
+ mkdocs = "^1.0"
37
+ mkdocstrings = { extras = ["python"], version = "^0.10" }
38
+ mkdocs-material = "^8.0"
39
+
31
40
  [tool.setuptools]
32
41
  license-files = []
33
42
 
@@ -11,6 +11,13 @@ from flet.utils import deprecated
11
11
 
12
12
 
13
13
  class AudioRecorderState(Enum):
14
+ """
15
+ The available AudioRecorder states are:
16
+
17
+ - `STOPPED`
18
+ - `RECORDING`
19
+ - `PAUSED`
20
+ """
14
21
  STOPPED = "stopped"
15
22
  RECORDING = "recording"
16
23
  PAUSED = "paused"
@@ -18,11 +25,29 @@ class AudioRecorderState(Enum):
18
25
 
19
26
  class AudioRecorderStateChangeEvent(ControlEvent):
20
27
  def __init__(self, e: ControlEvent):
28
+ """The current state of the audio recorder.
29
+
30
+ Value is of type [AudioRecorderState](audiorecorderstate.md)."""
21
31
  super().__init__(e.target, e.name, e.data, e.control, e.page)
22
32
  self.state: AudioRecorderState = AudioRecorderState(e.data)
23
33
 
24
34
 
25
35
  class AudioEncoder(Enum):
36
+ """
37
+ The `AudioEncoder` enum represents the different audio encoders supported by the audio recorder.
38
+
39
+ The available encoders are:
40
+
41
+ - `AACLC`: Advanced Audio Codec Low Complexity. A commonly used encoder for streaming and general audio recording.
42
+ - `AACELD`: Advanced Audio Codec Enhanced Low Delay. Suitable for low-latency applications like VoIP.
43
+ - `AACHE`: Advanced Audio Codec High Efficiency. Optimized for high-quality audio at lower bit rates.
44
+ - `AMRNB`: Adaptive Multi-Rate Narrow Band. Used for speech audio in mobile communication.
45
+ - `AMRWB`: Adaptive Multi-Rate Wide Band. Used for higher-quality speech audio.
46
+ - `OPUS`: A codec designed for both speech and audio applications, known for its versatility.
47
+ - `FLAC`: Free Lossless Audio Codec. Provides high-quality lossless audio compression.
48
+ - `WAV`: Standard audio format used for raw, uncompressed audio data.
49
+ - `PCM16BITS`: Pulse Code Modulation with 16-bit depth, used for high-fidelity audio.
50
+ """
26
51
  AACLC = "aacLc"
27
52
  AACELD = "aacEld"
28
53
  AACHE = "aacHe"
@@ -34,13 +59,13 @@ class AudioEncoder(Enum):
34
59
  PCM16BITS = "pcm16bits"
35
60
 
36
61
 
62
+
37
63
  class AudioRecorder(Control):
38
64
  """
39
65
  A control that allows you to record audio from your device.
40
66
 
41
- -----
42
-
43
- Online docs: https://flet.dev/docs/controls/audiorecorder
67
+ This control can record audio using different audio encoders and also allows configuration
68
+ of various audio recording parameters such as noise suppression, echo cancellation, and more.
44
69
  """
45
70
 
46
71
  def __init__(
@@ -84,6 +109,18 @@ class AudioRecorder(Control):
84
109
  def start_recording(
85
110
  self, output_path: str = None, wait_timeout: Optional[float] = 10
86
111
  ) -> bool:
112
+ """
113
+ Starts recording audio and saves it to the specified output path.
114
+
115
+ If not on the web, the `output_path` parameter must be provided.
116
+
117
+ Args:
118
+ output_path: The file path where the audio will be saved. It must be specified if not on web.
119
+ wait_timeout: The time in seconds to wait for the recording to start. Default is 10.
120
+
121
+ Returns:
122
+ bool: `True` if recording was successfully started, `False` otherwise.
123
+ """
87
124
  assert (
88
125
  self.page.web or output_path
89
126
  ), "output_path must be provided when not on web"
@@ -96,6 +133,15 @@ class AudioRecorder(Control):
96
133
  return started == "true"
97
134
 
98
135
  def is_recording(self, wait_timeout: Optional[float] = 5) -> bool:
136
+ """
137
+ Checks whether the audio recorder is currently recording.
138
+
139
+ Args:
140
+ wait_timeout: The time in seconds to wait for the result. Default is 5.
141
+
142
+ Returns:
143
+ bool: `True` if the recorder is currently recording, `False` otherwise.
144
+ """
99
145
  recording = self.invoke_method(
100
146
  "is_recording",
101
147
  wait_for_result=True,
@@ -104,6 +150,15 @@ class AudioRecorder(Control):
104
150
  return recording == "true"
105
151
 
106
152
  async def is_recording_async(self, wait_timeout: Optional[float] = 5) -> bool:
153
+ """
154
+ Asynchronously checks whether the audio recorder is currently recording.
155
+
156
+ Args:
157
+ wait_timeout: The time in seconds to wait for the result. Default is 5.
158
+
159
+ Returns:
160
+ bool: `True` if the recorder is currently recording, `False` otherwise.
161
+ """
107
162
  recording = await self.invoke_method_async(
108
163
  "is_recording",
109
164
  wait_for_result=True,
@@ -112,6 +167,15 @@ class AudioRecorder(Control):
112
167
  return recording == "true"
113
168
 
114
169
  def stop_recording(self, wait_timeout: Optional[float] = 5) -> Optional[str]:
170
+ """
171
+ Stops the audio recording and optionally returns the path to the saved file.
172
+
173
+ Args:
174
+ wait_timeout: The time in seconds to wait for the result. Default is 5.
175
+
176
+ Returns:
177
+ Optional[str]: The file path where the audio was saved or `None` if not applicable.
178
+ """
115
179
  return self.invoke_method(
116
180
  "stop_recording",
117
181
  wait_for_result=True,
@@ -121,6 +185,15 @@ class AudioRecorder(Control):
121
185
  async def stop_recording_async(
122
186
  self, wait_timeout: Optional[float] = 10
123
187
  ) -> Optional[str]:
188
+ """
189
+ Asynchronously stops the audio recording and optionally returns the path to the saved file.
190
+
191
+ Args:
192
+ wait_timeout: The time in seconds to wait for the result. Default is 10.
193
+
194
+ Returns:
195
+ Optional[str]: The file path where the audio was saved or `None` if not applicable.
196
+ """
124
197
  return await self.invoke_method_async(
125
198
  "stop_recording",
126
199
  wait_for_result=True,
@@ -128,6 +201,12 @@ class AudioRecorder(Control):
128
201
  )
129
202
 
130
203
  def cancel_recording(self, wait_timeout: Optional[float] = 5) -> None:
204
+ """
205
+ Cancels the current audio recording.
206
+
207
+ Args:
208
+ wait_timeout: The time in seconds to wait for the result. Default is 5.
209
+ """
131
210
  self.invoke_method(
132
211
  "cancel_recording",
133
212
  wait_for_result=True,
@@ -135,12 +214,27 @@ class AudioRecorder(Control):
135
214
  )
136
215
 
137
216
  def resume_recording(self):
217
+ """
218
+ Resumes a paused audio recording.
219
+ """
138
220
  self.invoke_method("resume_recording")
139
221
 
140
222
  def pause_recording(self):
223
+ """
224
+ Pauses the ongoing audio recording.
225
+ """
141
226
  self.invoke_method("pause_recording")
142
227
 
143
228
  def is_paused(self, wait_timeout: Optional[float] = 5) -> bool:
229
+ """
230
+ Checks whether the audio recorder is currently paused.
231
+
232
+ Args:
233
+ wait_timeout: The time in seconds to wait for the result. Default is 5.
234
+
235
+ Returns:
236
+ bool: `True` if the recorder is paused, `False` otherwise.
237
+ """
144
238
  paused = self.invoke_method(
145
239
  "is_paused",
146
240
  wait_for_result=True,
@@ -149,6 +243,15 @@ class AudioRecorder(Control):
149
243
  return paused == "true"
150
244
 
151
245
  async def is_paused_async(self, wait_timeout: Optional[float] = 5) -> bool:
246
+ """
247
+ Asynchronously checks whether the audio recorder is currently paused.
248
+
249
+ Args:
250
+ wait_timeout: The time in seconds to wait for the result. Default is 5.
251
+
252
+ Returns:
253
+ bool: `True` if the recorder is paused, `False` otherwise.
254
+ """
152
255
  supported = await self.invoke_method_async(
153
256
  "is_paused",
154
257
  wait_for_result=True,
@@ -159,6 +262,16 @@ class AudioRecorder(Control):
159
262
  def is_supported_encoder(
160
263
  self, encoder: AudioEncoder, wait_timeout: Optional[float] = 5
161
264
  ) -> bool:
265
+ """
266
+ Checks if the given audio encoder is supported by the recorder.
267
+
268
+ Args:
269
+ encoder: The audio encoder to check.
270
+ wait_timeout: The time in seconds to wait for the result. Default is 5.
271
+
272
+ Returns:
273
+ bool: `True` if the encoder is supported, `False` otherwise.
274
+ """
162
275
  supported = self.invoke_method(
163
276
  "is_supported_encoder",
164
277
  {
@@ -174,6 +287,16 @@ class AudioRecorder(Control):
174
287
  async def is_supported_encoder_async(
175
288
  self, encoder: AudioEncoder, wait_timeout: Optional[float] = 5
176
289
  ) -> bool:
290
+ """
291
+ Asynchronously checks if the given audio encoder is supported by the recorder.
292
+
293
+ Args:
294
+ encoder: The audio encoder to check.
295
+ wait_timeout: The time in seconds to wait for the result. Default is 5.
296
+
297
+ Returns:
298
+ bool: `True` if the encoder is supported, `False` otherwise.
299
+ """
177
300
  supported = await self.invoke_method_async(
178
301
  "is_supported_encoder",
179
302
  {
@@ -187,6 +310,15 @@ class AudioRecorder(Control):
187
310
  return supported == "true"
188
311
 
189
312
  def get_input_devices(self, wait_timeout: Optional[float] = 5) -> dict:
313
+ """
314
+ Retrieves the available input devices for recording.
315
+
316
+ Args:
317
+ wait_timeout: The time in seconds to wait for the result. Default is 5.
318
+
319
+ Returns:
320
+ dict: A dictionary of available input devices.
321
+ """
190
322
  devices = self.invoke_method(
191
323
  "get_input_devices",
192
324
  wait_for_result=True,
@@ -195,6 +327,15 @@ class AudioRecorder(Control):
195
327
  return json.loads(devices)
196
328
 
197
329
  async def get_input_devices_async(self, wait_timeout: Optional[float] = 5) -> dict:
330
+ """
331
+ Asynchronously retrieves the available input devices for recording.
332
+
333
+ Args:
334
+ wait_timeout: The time in seconds to wait for the result. Default is 5.
335
+
336
+ Returns:
337
+ dict: A dictionary of available input devices.
338
+ """
198
339
  devices = await self.invoke_method_async(
199
340
  "get_input_devices",
200
341
  wait_for_result=True,
@@ -203,6 +344,15 @@ class AudioRecorder(Control):
203
344
  return json.loads(devices)
204
345
 
205
346
  def has_permission(self, wait_timeout: Optional[float] = 10) -> bool:
347
+ """
348
+ Checks if the app has permission to record audio.
349
+
350
+ Args:
351
+ wait_timeout: The time in seconds to wait for the result. Default is 10.
352
+
353
+ Returns:
354
+ bool: `True` if the app has permission, `False` otherwise.
355
+ """
206
356
  p = self.invoke_method(
207
357
  "has_permission",
208
358
  wait_for_result=True,
@@ -211,6 +361,15 @@ class AudioRecorder(Control):
211
361
  return p == "true"
212
362
 
213
363
  async def has_permission_async(self, wait_timeout: Optional[float] = 10) -> bool:
364
+ """
365
+ Asynchronously checks if the app has permission to record audio.
366
+
367
+ Args:
368
+ wait_timeout: The time in seconds to wait for the result. Default is 10.
369
+
370
+ Returns:
371
+ bool: `True` if the app has permission, `False` otherwise.
372
+ """
214
373
  p = await self.invoke_method_async(
215
374
  "has_permission",
216
375
  wait_for_result=True,
@@ -221,6 +380,12 @@ class AudioRecorder(Control):
221
380
  # audio_encoder
222
381
  @property
223
382
  def audio_encoder(self):
383
+ """
384
+ The audio encoder to be used for recording.
385
+
386
+ Value is of type [`AudioEncoder`](audioencoder.md)
387
+ and defaults to `AudioEncoder.WAV`.
388
+ """
224
389
  return self._get_attr("audioEncoder")
225
390
 
226
391
  @audio_encoder.setter
@@ -230,6 +395,13 @@ class AudioRecorder(Control):
230
395
  # suppress_noise
231
396
  @property
232
397
  def suppress_noise(self) -> bool:
398
+ """
399
+ Whether to suppress noise during recording.
400
+
401
+ Defaults to `False`.
402
+
403
+ If `True`, it reduces the background noise while recording.
404
+ """
233
405
  return self._get_attr("suppressNoise", data_type="bool", def_value=False)
234
406
 
235
407
  @suppress_noise.setter
@@ -239,6 +411,13 @@ class AudioRecorder(Control):
239
411
  # cancel_echo
240
412
  @property
241
413
  def cancel_echo(self) -> bool:
414
+ """
415
+ Whether to cancel echo during recording.
416
+
417
+ Defaults to `False`.
418
+
419
+ If `True`, it reduces or cancels echo during recording.
420
+ """
242
421
  return self._get_attr("cancelEcho", data_type="bool", def_value=False)
243
422
 
244
423
  @cancel_echo.setter
@@ -248,6 +427,13 @@ class AudioRecorder(Control):
248
427
  # auto_gain
249
428
  @property
250
429
  def auto_gain(self) -> bool:
430
+ """
431
+ Whether to automatically adjust the audio gain during recording.
432
+
433
+ Defaults to `False`.
434
+
435
+ If `True`, the audio gain is automatically adjusted to avoid distortion or clipping.
436
+ """
251
437
  return self._get_attr("autoGain", data_type="bool", def_value=False)
252
438
 
253
439
  @auto_gain.setter
@@ -257,6 +443,11 @@ class AudioRecorder(Control):
257
443
  # bit_rate
258
444
  @property
259
445
  def bit_rate(self) -> OptionalNumber:
446
+ """
447
+ The bit rate of the audio recording.
448
+
449
+ This value is specified in kilobits per second (kbps). Defaults to `None`.
450
+ """
260
451
  return self._get_attr("bitRate")
261
452
 
262
453
  @bit_rate.setter
@@ -266,6 +457,11 @@ class AudioRecorder(Control):
266
457
  # sample_rate
267
458
  @property
268
459
  def sample_rate(self) -> OptionalNumber:
460
+ """
461
+ The sample rate for the audio recording.
462
+
463
+ This value is specified in Hertz (Hz). Defaults to `None`.
464
+ """
269
465
  return self._get_attr("sampleRate")
270
466
 
271
467
  @sample_rate.setter
@@ -275,6 +471,11 @@ class AudioRecorder(Control):
275
471
  # channels_num
276
472
  @property
277
473
  def channels_num(self) -> OptionalNumber:
474
+ """
475
+ The number of audio channels for the recording.
476
+
477
+ Can be `1` (mono) or `2` (stereo). Defaults to `None`.
478
+ """
278
479
  return self._get_attr("channels")
279
480
 
280
481
  @channels_num.setter
@@ -285,6 +486,11 @@ class AudioRecorder(Control):
285
486
  # on_state_changed
286
487
  @property
287
488
  def on_state_changed(self):
489
+ """
490
+ Event handler that is triggered when the recording state changes.
491
+
492
+ This handler should accept an instance of [`AudioRecorderStateChangeEvent`](audiorecorderstatechangeevent.md).
493
+ """
288
494
  return self.__on_state_changed.handler
289
495
 
290
496
  @on_state_changed.setter
@@ -292,3 +498,5 @@ class AudioRecorder(Control):
292
498
  self, handler: OptionalEventCallable[AudioRecorderStateChangeEvent]
293
499
  ):
294
500
  self.__on_state_changed.handler = handler
501
+
502
+
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.2
2
+ Name: flet-audio-recorder
3
+ Version: 0.2.0.dev18
4
+ Summary: AudioRecorder control for Flet
5
+ Author-email: Flet contributors <hello@flet.dev>
6
+ Project-URL: Homepage, https://flet.dev
7
+ Project-URL: Documentation, https://flet.dev/docs/controls/audiorecorder
8
+ Project-URL: Repository, https://github.com/flet-dev/flet-audio-recorder
9
+ Project-URL: Issues, https://github.com/flet-dev/flet-audio-recorder/issues
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: flet>=0.25.2
14
+
15
+ # AudioRecorder
16
+
17
+ Audio recorder from microphone to a given file path. Works on macOS, Linux, Windows, iOS, Android and web.
18
+ Based on the [record](https://pub.dev/packages/record) Dart/Flutter package.
19
+
20
+ **NOTE:** On Linux, encoding is provided by [fmedia](https://stsaz.github.io/fmedia/) which must be installed separately.
21
+
22
+ AudioRecorder control is non-visual and should be added to `page.overlay` list.
23
+
24
+ ## Installation
25
+
26
+ Add `flet-audio-recorder` as dependency to `pyproject.toml` of your Flet app:
27
+
28
+ ```
29
+ dependencies = [
30
+ "flet-audio-recorder",
31
+ "flet>=0.27.4",
32
+ ]
33
+ ```
34
+
35
+ ## Documentation
36
+
37
+ https://flet-dev.github.io/flet-audio-recorder/
@@ -13,42 +13,42 @@ packages:
13
13
  dependency: transitive
14
14
  description:
15
15
  name: async
16
- sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
16
+ sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63
17
17
  url: "https://pub.dev"
18
18
  source: hosted
19
- version: "2.11.0"
19
+ version: "2.12.0"
20
20
  boolean_selector:
21
21
  dependency: transitive
22
22
  description:
23
23
  name: boolean_selector
24
- sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
24
+ sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea"
25
25
  url: "https://pub.dev"
26
26
  source: hosted
27
- version: "2.1.1"
27
+ version: "2.1.2"
28
28
  characters:
29
29
  dependency: transitive
30
30
  description:
31
31
  name: characters
32
- sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
32
+ sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
33
33
  url: "https://pub.dev"
34
34
  source: hosted
35
- version: "1.3.0"
35
+ version: "1.4.0"
36
36
  clock:
37
37
  dependency: transitive
38
38
  description:
39
39
  name: clock
40
- sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
40
+ sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
41
41
  url: "https://pub.dev"
42
42
  source: hosted
43
- version: "1.1.1"
43
+ version: "1.1.2"
44
44
  collection:
45
45
  dependency: "direct main"
46
46
  description:
47
47
  name: collection
48
- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
48
+ sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
49
49
  url: "https://pub.dev"
50
50
  source: hosted
51
- version: "1.18.0"
51
+ version: "1.19.1"
52
52
  cross_file:
53
53
  dependency: transitive
54
54
  description:
@@ -77,18 +77,18 @@ packages:
77
77
  dependency: transitive
78
78
  description:
79
79
  name: fake_async
80
- sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
80
+ sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc"
81
81
  url: "https://pub.dev"
82
82
  source: hosted
83
- version: "1.3.1"
83
+ version: "1.3.2"
84
84
  ffi:
85
85
  dependency: transitive
86
86
  description:
87
87
  name: ffi
88
- sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6"
88
+ sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418"
89
89
  url: "https://pub.dev"
90
90
  source: hosted
91
- version: "2.1.3"
91
+ version: "2.1.4"
92
92
  file:
93
93
  dependency: transitive
94
94
  description:
@@ -101,10 +101,10 @@ packages:
101
101
  dependency: transitive
102
102
  description:
103
103
  name: file_picker
104
- sha256: c904b4ab56d53385563c7c39d8e9fa9af086f91495dfc48717ad84a42c3cf204
104
+ sha256: ab13ae8ef5580a411c458d6207b6774a6c237d77ac37011b13994879f68a8810
105
105
  url: "https://pub.dev"
106
106
  source: hosted
107
- version: "8.1.7"
107
+ version: "8.3.7"
108
108
  fixnum:
109
109
  dependency: transitive
110
110
  description:
@@ -159,18 +159,18 @@ packages:
159
159
  dependency: transitive
160
160
  description:
161
161
  name: flutter_markdown
162
- sha256: e37f4c69a07b07bb92622ef6b131a53c9aae48f64b176340af9e8e5238718487
162
+ sha256: e7bbc718adc9476aa14cfddc1ef048d2e21e4e8f18311aaac723266db9f9e7b5
163
163
  url: "https://pub.dev"
164
164
  source: hosted
165
- version: "0.7.5"
165
+ version: "0.7.6+2"
166
166
  flutter_plugin_android_lifecycle:
167
167
  dependency: transitive
168
168
  description:
169
169
  name: flutter_plugin_android_lifecycle
170
- sha256: "615a505aef59b151b46bbeef55b36ce2b6ed299d160c51d84281946f0aa0ce0e"
170
+ sha256: "5a1e6fb2c0561958d7e4c33574674bda7b77caaca7a33b758876956f2902eea3"
171
171
  url: "https://pub.dev"
172
172
  source: hosted
173
- version: "2.0.24"
173
+ version: "2.0.27"
174
174
  flutter_redux:
175
175
  dependency: transitive
176
176
  description:
@@ -209,18 +209,18 @@ packages:
209
209
  dependency: transitive
210
210
  description:
211
211
  name: http
212
- sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010
212
+ sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f
213
213
  url: "https://pub.dev"
214
214
  source: hosted
215
- version: "1.2.2"
215
+ version: "1.3.0"
216
216
  http_parser:
217
217
  dependency: transitive
218
218
  description:
219
219
  name: http_parser
220
- sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
220
+ sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
221
221
  url: "https://pub.dev"
222
222
  source: hosted
223
- version: "4.0.2"
223
+ version: "4.1.2"
224
224
  intl:
225
225
  dependency: transitive
226
226
  description:
@@ -249,18 +249,18 @@ packages:
249
249
  dependency: transitive
250
250
  description:
251
251
  name: leak_tracker
252
- sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
252
+ sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
253
253
  url: "https://pub.dev"
254
254
  source: hosted
255
- version: "10.0.5"
255
+ version: "10.0.8"
256
256
  leak_tracker_flutter_testing:
257
257
  dependency: transitive
258
258
  description:
259
259
  name: leak_tracker_flutter_testing
260
- sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
260
+ sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
261
261
  url: "https://pub.dev"
262
262
  source: hosted
263
- version: "3.0.5"
263
+ version: "3.0.9"
264
264
  leak_tracker_testing:
265
265
  dependency: transitive
266
266
  description:
@@ -297,10 +297,10 @@ packages:
297
297
  dependency: transitive
298
298
  description:
299
299
  name: matcher
300
- sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
300
+ sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
301
301
  url: "https://pub.dev"
302
302
  source: hosted
303
- version: "0.12.16+1"
303
+ version: "0.12.17"
304
304
  material_color_utilities:
305
305
  dependency: transitive
306
306
  description:
@@ -313,18 +313,18 @@ packages:
313
313
  dependency: transitive
314
314
  description:
315
315
  name: meta
316
- sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
316
+ sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
317
317
  url: "https://pub.dev"
318
318
  source: hosted
319
- version: "1.15.0"
319
+ version: "1.16.0"
320
320
  path:
321
321
  dependency: transitive
322
322
  description:
323
323
  name: path
324
- sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
324
+ sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
325
325
  url: "https://pub.dev"
326
326
  source: hosted
327
- version: "1.9.0"
327
+ version: "1.9.1"
328
328
  path_parsing:
329
329
  dependency: transitive
330
330
  description:
@@ -361,10 +361,10 @@ packages:
361
361
  dependency: transitive
362
362
  description:
363
363
  name: petitparser
364
- sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
364
+ sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646"
365
365
  url: "https://pub.dev"
366
366
  source: hosted
367
- version: "6.0.2"
367
+ version: "6.1.0"
368
368
  platform:
369
369
  dependency: transitive
370
370
  description:
@@ -385,18 +385,18 @@ packages:
385
385
  dependency: "direct main"
386
386
  description:
387
387
  name: record
388
- sha256: "8cb57763d954624fbc673874930c6f1ceca3baaf9bfee24b25da6fd451362394"
388
+ sha256: "2e3d56d196abcd69f1046339b75e5f3855b2406fc087e5991f6703f188aa03a6"
389
389
  url: "https://pub.dev"
390
390
  source: hosted
391
- version: "5.2.0"
391
+ version: "5.2.1"
392
392
  record_android:
393
393
  dependency: transitive
394
394
  description:
395
395
  name: record_android
396
- sha256: "0b4739a2502fff402b0ac0ff1d6b2740854d116d78e06a4a16b3989821f84446"
396
+ sha256: "36e009c3b83e034321a44a7683d95dd055162a231f95600f7da579dcc79701f9"
397
397
  url: "https://pub.dev"
398
398
  source: hosted
399
- version: "1.3.0"
399
+ version: "1.3.1"
400
400
  record_darwin:
401
401
  dependency: transitive
402
402
  description:
@@ -425,18 +425,18 @@ packages:
425
425
  dependency: transitive
426
426
  description:
427
427
  name: record_web
428
- sha256: "10cb041349024ce4256e11dd35874df26d8b45b800678f2f51fd1318901adc64"
428
+ sha256: ef6f5c7760f22d6785ee8d97a2133ff14cb839c65e525ad831eb7f891d83f592
429
429
  url: "https://pub.dev"
430
430
  source: hosted
431
- version: "1.1.4"
431
+ version: "1.1.5"
432
432
  record_windows:
433
433
  dependency: transitive
434
434
  description:
435
435
  name: record_windows
436
- sha256: "7bce0ac47454212ca8bfa72791d8b6a951f2fb0d4b953b64443c014227f035b4"
436
+ sha256: "26bfebc8899f4fa5b6b044089887dc42115820cd6a907bdf40c16e909e87de0a"
437
437
  url: "https://pub.dev"
438
438
  source: hosted
439
- version: "1.0.4"
439
+ version: "1.0.5"
440
440
  redux:
441
441
  dependency: transitive
442
442
  description:
@@ -505,18 +505,18 @@ packages:
505
505
  dependency: transitive
506
506
  description:
507
507
  name: shared_preferences
508
- sha256: a752ce92ea7540fc35a0d19722816e04d0e72828a4200e83a98cf1a1eb524c9a
508
+ sha256: "846849e3e9b68f3ef4b60c60cf4b3e02e9321bc7f4d8c4692cf87ffa82fc8a3a"
509
509
  url: "https://pub.dev"
510
510
  source: hosted
511
- version: "2.3.5"
511
+ version: "2.5.2"
512
512
  shared_preferences_android:
513
513
  dependency: transitive
514
514
  description:
515
515
  name: shared_preferences_android
516
- sha256: bf808be89fe9dc467475e982c1db6c2faf3d2acf54d526cd5ec37d86c99dbd84
516
+ sha256: "3ec7210872c4ba945e3244982918e502fa2bfb5230dff6832459ca0e1879b7ad"
517
517
  url: "https://pub.dev"
518
518
  source: hosted
519
- version: "2.4.1"
519
+ version: "2.4.8"
520
520
  shared_preferences_foundation:
521
521
  dependency: transitive
522
522
  description:
@@ -545,10 +545,10 @@ packages:
545
545
  dependency: transitive
546
546
  description:
547
547
  name: shared_preferences_web
548
- sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e
548
+ sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019
549
549
  url: "https://pub.dev"
550
550
  source: hosted
551
- version: "2.4.2"
551
+ version: "2.4.3"
552
552
  shared_preferences_windows:
553
553
  dependency: transitive
554
554
  description:
@@ -561,15 +561,15 @@ packages:
561
561
  dependency: transitive
562
562
  description: flutter
563
563
  source: sdk
564
- version: "0.0.99"
564
+ version: "0.0.0"
565
565
  source_span:
566
566
  dependency: transitive
567
567
  description:
568
568
  name: source_span
569
- sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
569
+ sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
570
570
  url: "https://pub.dev"
571
571
  source: hosted
572
- version: "1.10.0"
572
+ version: "1.10.1"
573
573
  sprintf:
574
574
  dependency: transitive
575
575
  description:
@@ -582,42 +582,42 @@ packages:
582
582
  dependency: transitive
583
583
  description:
584
584
  name: stack_trace
585
- sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
585
+ sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
586
586
  url: "https://pub.dev"
587
587
  source: hosted
588
- version: "1.11.1"
588
+ version: "1.12.1"
589
589
  stream_channel:
590
590
  dependency: transitive
591
591
  description:
592
592
  name: stream_channel
593
- sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
593
+ sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
594
594
  url: "https://pub.dev"
595
595
  source: hosted
596
- version: "2.1.2"
596
+ version: "2.1.4"
597
597
  string_scanner:
598
598
  dependency: transitive
599
599
  description:
600
600
  name: string_scanner
601
- sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
601
+ sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
602
602
  url: "https://pub.dev"
603
603
  source: hosted
604
- version: "1.2.0"
604
+ version: "1.4.1"
605
605
  term_glyph:
606
606
  dependency: transitive
607
607
  description:
608
608
  name: term_glyph
609
- sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
609
+ sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
610
610
  url: "https://pub.dev"
611
611
  source: hosted
612
- version: "1.2.1"
612
+ version: "1.2.2"
613
613
  test_api:
614
614
  dependency: transitive
615
615
  description:
616
616
  name: test_api
617
- sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
617
+ sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
618
618
  url: "https://pub.dev"
619
619
  source: hosted
620
- version: "0.7.2"
620
+ version: "0.7.4"
621
621
  typed_data:
622
622
  dependency: transitive
623
623
  description:
@@ -638,10 +638,10 @@ packages:
638
638
  dependency: transitive
639
639
  description:
640
640
  name: url_launcher_android
641
- sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193"
641
+ sha256: "1d0eae19bd7606ef60fe69ef3b312a437a16549476c42321d5dc1506c9ca3bf4"
642
642
  url: "https://pub.dev"
643
643
  source: hosted
644
- version: "6.3.14"
644
+ version: "6.3.15"
645
645
  url_launcher_ios:
646
646
  dependency: transitive
647
647
  description:
@@ -678,10 +678,10 @@ packages:
678
678
  dependency: transitive
679
679
  description:
680
680
  name: url_launcher_web
681
- sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e"
681
+ sha256: "3ba963161bd0fe395917ba881d320b9c4f6dd3c4a233da62ab18a5025c85f1e9"
682
682
  url: "https://pub.dev"
683
683
  source: hosted
684
- version: "2.3.3"
684
+ version: "2.4.0"
685
685
  url_launcher_windows:
686
686
  dependency: transitive
687
687
  description:
@@ -702,10 +702,10 @@ packages:
702
702
  dependency: transitive
703
703
  description:
704
704
  name: vector_graphics
705
- sha256: "27d5fefe86fb9aace4a9f8375b56b3c292b64d8c04510df230f849850d912cb7"
705
+ sha256: "44cc7104ff32563122a929e4620cf3efd584194eec6d1d913eb5ba593dbcf6de"
706
706
  url: "https://pub.dev"
707
707
  source: hosted
708
- version: "1.1.15"
708
+ version: "1.1.18"
709
709
  vector_graphics_codec:
710
710
  dependency: transitive
711
711
  description:
@@ -734,18 +734,18 @@ packages:
734
734
  dependency: transitive
735
735
  description:
736
736
  name: vm_service
737
- sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
737
+ sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14"
738
738
  url: "https://pub.dev"
739
739
  source: hosted
740
- version: "14.2.4"
740
+ version: "14.3.1"
741
741
  web:
742
742
  dependency: transitive
743
743
  description:
744
744
  name: web
745
- sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb
745
+ sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
746
746
  url: "https://pub.dev"
747
747
  source: hosted
748
- version: "1.1.0"
748
+ version: "1.1.1"
749
749
  web_socket_channel:
750
750
  dependency: transitive
751
751
  description:
@@ -758,10 +758,10 @@ packages:
758
758
  dependency: transitive
759
759
  description:
760
760
  name: win32
761
- sha256: "154360849a56b7b67331c21f09a386562d88903f90a1099c5987afc1912e1f29"
761
+ sha256: b89e6e24d1454e149ab20fbb225af58660f0c0bf4475544650700d8e2da54aef
762
762
  url: "https://pub.dev"
763
763
  source: hosted
764
- version: "5.10.0"
764
+ version: "5.11.0"
765
765
  window_manager:
766
766
  dependency: transitive
767
767
  description:
@@ -795,5 +795,5 @@ packages:
795
795
  source: hosted
796
796
  version: "6.5.0"
797
797
  sdks:
798
- dart: ">=3.5.0 <4.0.0"
799
- flutter: ">=3.24.0"
798
+ dart: ">=3.7.0 <4.0.0"
799
+ flutter: ">=3.27.0"
@@ -2,7 +2,7 @@ name: flet_audio_recorder
2
2
  description: Flet AudioRecorder control
3
3
  homepage: https://flet.dev
4
4
  repository: https://github.com/flet-dev/flet-audio-recorder/src/flutter/flet_audio_recorder
5
- version: 0.1.0
5
+ version: 0.2.0
6
6
  environment:
7
7
  sdk: '>=3.2.3 <4.0.0'
8
8
  flutter: '>=1.17.0'
@@ -1,93 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: flet-audio-recorder
3
- Version: 0.1.0.dev1
4
- Summary: AudioRecorder control for Flet
5
- Author-email: Flet contributors <hello@flet.dev>
6
- Project-URL: Homepage, https://flet.dev
7
- Project-URL: Documentation, https://flet.dev/docs/controls/audiorecorder
8
- Project-URL: Repository, https://github.com/flet-dev/flet-audio-recorder
9
- Project-URL: Issues, https://github.com/flet-dev/flet-audio-recorder/issues
10
- Classifier: License :: OSI Approved :: Apache Software License
11
- Requires-Python: >=3.8
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: flet>=0.25.2
14
-
15
- # AudioRecorder control for Flet
16
-
17
- `AudioRecorder` control for Flet.
18
-
19
- ## Usage
20
-
21
- Add `flet-audio-recorder` as dependency (`pyproject.toml` or `requirements.txt`) to your Flet project.
22
-
23
- ## Example
24
-
25
- ```py
26
-
27
- import flet as ft
28
-
29
- import flet_audio_recorder as far
30
-
31
- async def main(page: ft.Page):
32
- page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
33
- page.appbar = ft.AppBar(title=ft.Text("Audio Recorder"), center_title=True)
34
-
35
- path = "test-audio-file.wav"
36
-
37
- async def handle_start_recording(e):
38
- print(f"StartRecording: {path}")
39
- await audio_rec.start_recording_async(path)
40
-
41
- async def handle_stop_recording(e):
42
- output_path = await audio_rec.stop_recording_async()
43
- print(f"StopRecording: {output_path}")
44
- if page.web and output_path is not None:
45
- await page.launch_url_async(output_path)
46
-
47
- async def handle_list_devices(e):
48
- devices = await audio_rec.get_input_devices_async()
49
- print(devices)
50
-
51
- async def handle_has_permission(e):
52
- try:
53
- print(f"HasPermission: {await audio_rec.has_permission_async()}")
54
- except Exception as e:
55
- print(e)
56
-
57
- async def handle_pause(e):
58
- print(f"isRecording: {await audio_rec.is_recording_async()}")
59
- if await audio_rec.is_recording_async():
60
- await audio_rec.pause_recording_async()
61
-
62
- async def handle_resume(e):
63
- print(f"isPaused: {await audio_rec.is_paused_async()}")
64
- if await audio_rec.is_paused_async():
65
- await audio_rec.resume_recording_async()
66
-
67
- async def handle_audio_encoding_test(e):
68
- for i in list(far.AudioEncoder):
69
- print(f"{i}: {await audio_rec.is_supported_encoder_async(i)}")
70
-
71
- async def handle_state_change(e):
72
- print(f"State Changed: {e.data}")
73
-
74
- audio_rec = far.AudioRecorder(
75
- audio_encoder=far.AudioEncoder.WAV,
76
- on_state_changed=handle_state_change,
77
- )
78
- page.overlay.append(audio_rec)
79
- await page.update_async()
80
-
81
- await page.add_async(
82
- ft.ElevatedButton("Start Audio Recorder", on_click=handle_start_recording),
83
- ft.ElevatedButton("Stop Audio Recorder", on_click=handle_stop_recording),
84
- ft.ElevatedButton("List Devices", on_click=handle_list_devices),
85
- ft.ElevatedButton("Pause Recording", on_click=handle_pause),
86
- ft.ElevatedButton("Resume Recording", on_click=handle_resume),
87
- ft.ElevatedButton("Test AudioEncodings", on_click=handle_audio_encoding_test),
88
- ft.ElevatedButton("Has Permission", on_click=handle_has_permission),
89
- )
90
-
91
-
92
- ft.app(main)
93
- ```
@@ -1,79 +0,0 @@
1
- # AudioRecorder control for Flet
2
-
3
- `AudioRecorder` control for Flet.
4
-
5
- ## Usage
6
-
7
- Add `flet-audio-recorder` as dependency (`pyproject.toml` or `requirements.txt`) to your Flet project.
8
-
9
- ## Example
10
-
11
- ```py
12
-
13
- import flet as ft
14
-
15
- import flet_audio_recorder as far
16
-
17
- async def main(page: ft.Page):
18
- page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
19
- page.appbar = ft.AppBar(title=ft.Text("Audio Recorder"), center_title=True)
20
-
21
- path = "test-audio-file.wav"
22
-
23
- async def handle_start_recording(e):
24
- print(f"StartRecording: {path}")
25
- await audio_rec.start_recording_async(path)
26
-
27
- async def handle_stop_recording(e):
28
- output_path = await audio_rec.stop_recording_async()
29
- print(f"StopRecording: {output_path}")
30
- if page.web and output_path is not None:
31
- await page.launch_url_async(output_path)
32
-
33
- async def handle_list_devices(e):
34
- devices = await audio_rec.get_input_devices_async()
35
- print(devices)
36
-
37
- async def handle_has_permission(e):
38
- try:
39
- print(f"HasPermission: {await audio_rec.has_permission_async()}")
40
- except Exception as e:
41
- print(e)
42
-
43
- async def handle_pause(e):
44
- print(f"isRecording: {await audio_rec.is_recording_async()}")
45
- if await audio_rec.is_recording_async():
46
- await audio_rec.pause_recording_async()
47
-
48
- async def handle_resume(e):
49
- print(f"isPaused: {await audio_rec.is_paused_async()}")
50
- if await audio_rec.is_paused_async():
51
- await audio_rec.resume_recording_async()
52
-
53
- async def handle_audio_encoding_test(e):
54
- for i in list(far.AudioEncoder):
55
- print(f"{i}: {await audio_rec.is_supported_encoder_async(i)}")
56
-
57
- async def handle_state_change(e):
58
- print(f"State Changed: {e.data}")
59
-
60
- audio_rec = far.AudioRecorder(
61
- audio_encoder=far.AudioEncoder.WAV,
62
- on_state_changed=handle_state_change,
63
- )
64
- page.overlay.append(audio_rec)
65
- await page.update_async()
66
-
67
- await page.add_async(
68
- ft.ElevatedButton("Start Audio Recorder", on_click=handle_start_recording),
69
- ft.ElevatedButton("Stop Audio Recorder", on_click=handle_stop_recording),
70
- ft.ElevatedButton("List Devices", on_click=handle_list_devices),
71
- ft.ElevatedButton("Pause Recording", on_click=handle_pause),
72
- ft.ElevatedButton("Resume Recording", on_click=handle_resume),
73
- ft.ElevatedButton("Test AudioEncodings", on_click=handle_audio_encoding_test),
74
- ft.ElevatedButton("Has Permission", on_click=handle_has_permission),
75
- )
76
-
77
-
78
- ft.app(main)
79
- ```
@@ -1,93 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: flet-audio-recorder
3
- Version: 0.1.0.dev1
4
- Summary: AudioRecorder control for Flet
5
- Author-email: Flet contributors <hello@flet.dev>
6
- Project-URL: Homepage, https://flet.dev
7
- Project-URL: Documentation, https://flet.dev/docs/controls/audiorecorder
8
- Project-URL: Repository, https://github.com/flet-dev/flet-audio-recorder
9
- Project-URL: Issues, https://github.com/flet-dev/flet-audio-recorder/issues
10
- Classifier: License :: OSI Approved :: Apache Software License
11
- Requires-Python: >=3.8
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: flet>=0.25.2
14
-
15
- # AudioRecorder control for Flet
16
-
17
- `AudioRecorder` control for Flet.
18
-
19
- ## Usage
20
-
21
- Add `flet-audio-recorder` as dependency (`pyproject.toml` or `requirements.txt`) to your Flet project.
22
-
23
- ## Example
24
-
25
- ```py
26
-
27
- import flet as ft
28
-
29
- import flet_audio_recorder as far
30
-
31
- async def main(page: ft.Page):
32
- page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
33
- page.appbar = ft.AppBar(title=ft.Text("Audio Recorder"), center_title=True)
34
-
35
- path = "test-audio-file.wav"
36
-
37
- async def handle_start_recording(e):
38
- print(f"StartRecording: {path}")
39
- await audio_rec.start_recording_async(path)
40
-
41
- async def handle_stop_recording(e):
42
- output_path = await audio_rec.stop_recording_async()
43
- print(f"StopRecording: {output_path}")
44
- if page.web and output_path is not None:
45
- await page.launch_url_async(output_path)
46
-
47
- async def handle_list_devices(e):
48
- devices = await audio_rec.get_input_devices_async()
49
- print(devices)
50
-
51
- async def handle_has_permission(e):
52
- try:
53
- print(f"HasPermission: {await audio_rec.has_permission_async()}")
54
- except Exception as e:
55
- print(e)
56
-
57
- async def handle_pause(e):
58
- print(f"isRecording: {await audio_rec.is_recording_async()}")
59
- if await audio_rec.is_recording_async():
60
- await audio_rec.pause_recording_async()
61
-
62
- async def handle_resume(e):
63
- print(f"isPaused: {await audio_rec.is_paused_async()}")
64
- if await audio_rec.is_paused_async():
65
- await audio_rec.resume_recording_async()
66
-
67
- async def handle_audio_encoding_test(e):
68
- for i in list(far.AudioEncoder):
69
- print(f"{i}: {await audio_rec.is_supported_encoder_async(i)}")
70
-
71
- async def handle_state_change(e):
72
- print(f"State Changed: {e.data}")
73
-
74
- audio_rec = far.AudioRecorder(
75
- audio_encoder=far.AudioEncoder.WAV,
76
- on_state_changed=handle_state_change,
77
- )
78
- page.overlay.append(audio_rec)
79
- await page.update_async()
80
-
81
- await page.add_async(
82
- ft.ElevatedButton("Start Audio Recorder", on_click=handle_start_recording),
83
- ft.ElevatedButton("Stop Audio Recorder", on_click=handle_stop_recording),
84
- ft.ElevatedButton("List Devices", on_click=handle_list_devices),
85
- ft.ElevatedButton("Pause Recording", on_click=handle_pause),
86
- ft.ElevatedButton("Resume Recording", on_click=handle_resume),
87
- ft.ElevatedButton("Test AudioEncodings", on_click=handle_audio_encoding_test),
88
- ft.ElevatedButton("Has Permission", on_click=handle_has_permission),
89
- )
90
-
91
-
92
- ft.app(main)
93
- ```