flet-audio 0.2.0.dev35__tar.gz → 0.2.0.dev51__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.

Potentially problematic release.


This version of flet-audio might be problematic. Click here for more details.

Files changed (24) hide show
  1. {flet_audio-0.2.0.dev35/src/flet_audio.egg-info → flet_audio-0.2.0.dev51}/PKG-INFO +2 -2
  2. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/pyproject.toml +2 -2
  3. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flet_audio/audio.py +27 -21
  4. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flet_audio/types.py +23 -3
  5. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51/src/flet_audio.egg-info}/PKG-INFO +2 -2
  6. flet_audio-0.2.0.dev51/src/flet_audio.egg-info/requires.txt +1 -0
  7. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flutter/flet_audio/lib/src/audio.dart +4 -7
  8. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flutter/flet_audio/pubspec.lock +2 -2
  9. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flutter/flet_audio/pubspec.yaml +2 -2
  10. flet_audio-0.2.0.dev35/src/flet_audio.egg-info/requires.txt +0 -1
  11. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/LICENSE +0 -0
  12. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/README.md +0 -0
  13. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/setup.cfg +0 -0
  14. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flet_audio/__init__.py +0 -0
  15. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flet_audio.egg-info/SOURCES.txt +0 -0
  16. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flet_audio.egg-info/dependency_links.txt +0 -0
  17. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flet_audio.egg-info/top_level.txt +0 -0
  18. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flutter/flet_audio/CHANGELOG.md +0 -0
  19. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flutter/flet_audio/LICENSE +0 -0
  20. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flutter/flet_audio/README.md +0 -0
  21. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flutter/flet_audio/analysis_options.yaml +0 -0
  22. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flutter/flet_audio/lib/flet_audio.dart +0 -0
  23. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flutter/flet_audio/lib/src/extension.dart +0 -0
  24. {flet_audio-0.2.0.dev35 → flet_audio-0.2.0.dev51}/src/flutter/flet_audio/lib/src/utils/audio.dart +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-audio
3
- Version: 0.2.0.dev35
3
+ Version: 0.2.0.dev51
4
4
  Summary: Eases audio integration and playback in Flet apps.
5
5
  Author-email: Flet contributors <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -11,7 +11,7 @@ Project-URL: Issues, https://github.com/flet-dev/flet-audio/issues
11
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: flet>=0.70.0
14
+ Requires-Dist: flet>=0.70.0.dev0
15
15
  Dynamic: license-file
16
16
 
17
17
  # flet-audio
@@ -1,13 +1,13 @@
1
1
  [project]
2
2
  name = "flet-audio"
3
- version = "0.2.0.dev35"
3
+ version = "0.2.0.dev51"
4
4
  description = "Eases audio integration and playback in Flet apps."
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Flet contributors", email = "hello@flet.dev" }]
7
7
  license = "Apache-2.0"
8
8
  requires-python = ">=3.10"
9
9
  dependencies = [
10
- "flet >=0.70.0",
10
+ "flet >=0.70.0.dev0",
11
11
  ]
12
12
 
13
13
  [project.urls]
@@ -20,7 +20,8 @@ class Audio(ft.Service):
20
20
  AssertionError: If both [`src`][(c).] and [`src_base64`][(c).] are `None`.
21
21
 
22
22
  Note:
23
- This control is non-visual and should be added to `Page.services` list before it can be used.
23
+ This control is non-visual and should be added to [`Page.services`][flet.Page.services]
24
+ list before it can be used.
24
25
  """
25
26
 
26
27
  src: Optional[str] = None
@@ -36,7 +37,7 @@ class Audio(ft.Service):
36
37
 
37
38
  src_base64: Optional[str] = None
38
39
  """
39
- Sets the contents of audio file encoded in base-64 format.
40
+ Defines the contents of audio file encoded in base-64 format.
40
41
 
41
42
  Note:
42
43
  - At least one of [`src`][..] or `src_base64` must be provided,
@@ -62,7 +63,7 @@ class Audio(ft.Service):
62
63
 
63
64
  balance: ft.Number = 0.0
64
65
  """
65
- Sets the stereo balance.
66
+ Defines the stereo balance.
66
67
 
67
68
 
68
69
  * `-1` - The left channel is at full volume; the right channel is silent.
@@ -72,7 +73,7 @@ class Audio(ft.Service):
72
73
 
73
74
  playback_rate: ft.Number = 1.0
74
75
  """
75
- Sets the playback rate.
76
+ Defines the playback rate.
76
77
 
77
78
  Should ideally be set when creating the constructor.
78
79
 
@@ -83,39 +84,33 @@ class Audio(ft.Service):
83
84
 
84
85
  release_mode: ReleaseMode = ReleaseMode.RELEASE
85
86
  """
86
- Sets the release mode.
87
+ Defines the release mode.
87
88
  """
88
89
 
89
- on_loaded: ft.OptionalControlEventHandler["Audio"] = None
90
+ on_loaded: Optional[ft.ControlEventHandler["Audio"]] = None
90
91
  """
91
92
  Fires when an audio is loaded/buffered.
92
93
  """
93
94
 
94
- on_duration_change: ft.OptionalEventHandler[AudioDurationChangeEvent["Audio"]] = None
95
+ on_duration_change: Optional[ft.EventHandler[AudioDurationChangeEvent["Audio"]]] = None
95
96
  """
96
97
  Fires as soon as audio duration is available (it might take a while to download or buffer it).
97
-
98
- Event handler argument is of type [`AudioDurationChangeEvent`][(p).].
99
98
  """
100
99
 
101
- on_state_change: ft.OptionalEventHandler[AudioStateChangeEvent["Audio"]] = None
100
+ on_state_change: Optional[ft.EventHandler[AudioStateChangeEvent["Audio"]]] = None
102
101
  """
103
- Fires when audio player state changes.
104
-
105
- Event handler argument is of type [`AudioStateChangeEvent`][(p).].
102
+ Fires when audio player state changes.
106
103
  """
107
104
 
108
- on_position_change: ft.OptionalEventHandler[AudioPositionChangeEvent["Audio"]] = None
105
+ on_position_change: Optional[ft.EventHandler[AudioPositionChangeEvent["Audio"]]] = None
109
106
  """
110
107
  Fires when audio position is changed.
111
108
  Will continuously update the position of the playback every 1 second if the status is playing.
112
109
 
113
110
  Can be used for a progress bar.
114
-
115
- Event handler argument is of type [`AudioPositionChangeEvent`][(p).].
116
111
  """
117
112
 
118
- on_seek_complete: ft.OptionalControlEventHandler["Audio"] = None
113
+ on_seek_complete: Optional[ft.ControlEventHandler["Audio"]] = None
119
114
  """
120
115
  Fires on seek completions.
121
116
  An event is going to be sent as soon as the audio seek is finished.
@@ -132,6 +127,7 @@ class Audio(ft.Service):
132
127
  Args:
133
128
  position: The position to start playback from.
134
129
  timeout: The maximum amount of time (in seconds) to wait for a response.
130
+
135
131
  Raises:
136
132
  TimeoutError: If the request times out.
137
133
  """
@@ -144,6 +140,7 @@ class Audio(ft.Service):
144
140
  Args:
145
141
  position: The position to start playback from.
146
142
  timeout: The maximum amount of time (in seconds) to wait for a response.
143
+
147
144
  Raises:
148
145
  TimeoutError: If the request times out.
149
146
  """
@@ -153,7 +150,7 @@ class Audio(ft.Service):
153
150
  """
154
151
  Pauses the audio that is currently playing.
155
152
 
156
- If you call [`resume()`][.resume] or [`resume_async()`][.resume_async] later,
153
+ If you call [`resume()`][(c).resume] or [`resume_async()`][(c).resume_async] later,
157
154
  the audio will resume from the point that it has been paused.
158
155
  """
159
156
  await self._invoke_method_async("pause", timeout=timeout)
@@ -162,11 +159,12 @@ class Audio(ft.Service):
162
159
  """
163
160
  Pauses the audio that is currently playing.
164
161
 
165
- If you call [`resume()`][.resume] or [`resume_async()`][.resume_async] later,
162
+ If you call [`resume()`][(c).resume] or [`resume_async()`][(c).resume_async] later,
166
163
  the audio will resume from the point that it has been paused.
167
164
 
168
165
  Args:
169
166
  timeout: The maximum amount of time (in seconds) to wait for a response.
167
+
170
168
  Raises:
171
169
  TimeoutError: If the request times out.
172
170
  """
@@ -178,6 +176,7 @@ class Audio(ft.Service):
178
176
 
179
177
  Args:
180
178
  timeout: The maximum amount of time (in seconds) to wait for a response.
179
+
181
180
  Raises:
182
181
  TimeoutError: If the request times out.
183
182
  """
@@ -189,6 +188,7 @@ class Audio(ft.Service):
189
188
 
190
189
  Args:
191
190
  timeout: The maximum amount of time (in seconds) to wait for a response.
191
+
192
192
  Raises:
193
193
  TimeoutError: If the request times out.
194
194
  """
@@ -198,10 +198,11 @@ class Audio(ft.Service):
198
198
  """
199
199
  Releases the resources associated with this media player.
200
200
  These are going to be fetched or buffered again as soon as
201
- you change the source or call [`resume()`][.resume] or [`resume_async()`][.resume_async].
201
+ you change the source or call [`resume()`][(c).resume] or [`resume_async()`][(c).resume_async].
202
202
 
203
203
  Args:
204
204
  timeout: The maximum amount of time (in seconds) to wait for a response.
205
+
205
206
  Raises:
206
207
  TimeoutError: If the request times out.
207
208
  """
@@ -211,10 +212,11 @@ class Audio(ft.Service):
211
212
  """
212
213
  Releases the resources associated with this media player.
213
214
  These are going to be fetched or buffered again as soon as
214
- you change the source or call [`resume()`][.resume] or [`resume_async()`][.resume_async].
215
+ you change the source or call [`resume()`][(c).resume] or [`resume_async()`][(c).resume_async].
215
216
 
216
217
  Args:
217
218
  timeout: The maximum amount of time (in seconds) to wait for a response.
219
+
218
220
  Raises:
219
221
  TimeoutError: If the request times out.
220
222
  """
@@ -227,6 +229,7 @@ class Audio(ft.Service):
227
229
  Args:
228
230
  position: The position to seek/move to.
229
231
  timeout: The maximum amount of time (in seconds) to wait for a response.
232
+
230
233
  Raises:
231
234
  TimeoutError: If the request times out.
232
235
  """
@@ -239,6 +242,7 @@ class Audio(ft.Service):
239
242
  Args:
240
243
  position: The position to seek/move to.
241
244
  timeout: The maximum amount of time (in seconds) to wait for a response.
245
+
242
246
  Raises:
243
247
  TimeoutError: If the request times out.
244
248
  """
@@ -253,8 +257,10 @@ class Audio(ft.Service):
253
257
 
254
258
  Args:
255
259
  timeout: The maximum amount of time (in seconds) to wait for a response.
260
+
256
261
  Returns:
257
262
  The duration of audio playback.
263
+
258
264
  Raises:
259
265
  TimeoutError: If the request times out.
260
266
  """
@@ -1,3 +1,4 @@
1
+ from dataclasses import dataclass, field
1
2
  from enum import Enum
2
3
 
3
4
  import flet as ft
@@ -19,10 +20,10 @@ class ReleaseMode(Enum):
19
20
  Releases all resources, just like calling release method.
20
21
 
21
22
  Info:
22
- - In Android, the media player is quite resource-intensive, and this will
23
+ - On Android, the media player is quite resource-intensive, and this will
23
24
  let it go. Data will be buffered again when needed (if it's a remote file,
24
25
  it will be downloaded again).
25
- - In iOS and macOS, works just like [`Audio.stop()`][(p).Audio.stop] method.
26
+ - On iOS and macOS, works just like [`Audio.release()`][(p).Audio.release] method.
26
27
  """
27
28
 
28
29
  LOOP = "loop"
@@ -41,6 +42,7 @@ class ReleaseMode(Enum):
41
42
 
42
43
  class AudioState(Enum):
43
44
  """The state of the audio player."""
45
+
44
46
  STOPPED = "stopped"
45
47
  """The audio player is stopped."""
46
48
 
@@ -57,13 +59,31 @@ class AudioState(Enum):
57
59
  """The audio player has been disposed of and should not be used anymore."""
58
60
 
59
61
 
62
+ @dataclass
60
63
  class AudioStateChangeEvent(ft.Event[ft.EventControlType]):
64
+ """
65
+ Event triggered when the audio playback state changes.
66
+ """
67
+
61
68
  state: AudioState
69
+ """The current state of the audio player."""
62
70
 
63
71
 
72
+ @dataclass
64
73
  class AudioPositionChangeEvent(ft.Event[ft.EventControlType]):
74
+ """
75
+ Event triggered when the audio playback position changes.
76
+ """
77
+
65
78
  position: int
79
+ """The current playback position in milliseconds."""
66
80
 
67
81
 
82
+ @dataclass
68
83
  class AudioDurationChangeEvent(ft.Event[ft.EventControlType]):
69
- duration: int
84
+ """
85
+ Event triggered when the audio duration changes.
86
+ """
87
+
88
+ duration: ft.Duration
89
+ """The duration of the audio."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-audio
3
- Version: 0.2.0.dev35
3
+ Version: 0.2.0.dev51
4
4
  Summary: Eases audio integration and playback in Flet apps.
5
5
  Author-email: Flet contributors <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -11,7 +11,7 @@ Project-URL: Issues, https://github.com/flet-dev/flet-audio/issues
11
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: flet>=0.70.0
14
+ Requires-Dist: flet>=0.70.0.dev0
15
15
  Dynamic: license-file
16
16
 
17
17
  # flet-audio
@@ -0,0 +1 @@
1
+ flet>=0.70.0.dev0
@@ -33,12 +33,12 @@ class AudioService extends FletService {
33
33
 
34
34
  _onDurationChangedSubscription =
35
35
  player.onDurationChanged.listen((duration) {
36
- control.triggerEvent(
37
- "duration_change", {"duration": duration.inMilliseconds});
36
+ control.triggerEvent("duration_change", {"duration": duration});
38
37
  _duration = duration;
39
38
  });
40
39
 
41
- _onStateChangedSubscription = player.onPlayerStateChanged.listen((PlayerState state) {
40
+ _onStateChangedSubscription =
41
+ player.onPlayerStateChanged.listen((PlayerState state) {
42
42
  control.triggerEvent("state_change", {"state": state.name});
43
43
  });
44
44
 
@@ -116,10 +116,7 @@ class AudioService extends FletService {
116
116
  await player.setPlaybackRate(playbackRate);
117
117
  }
118
118
 
119
- if (!kIsWeb &&
120
- balance != _balance &&
121
- balance >= -1 &&
122
- balance <= 1) {
119
+ if (!kIsWeb && balance != _balance && balance >= -1 && balance <= 1) {
123
120
  _balance = balance;
124
121
  await player.setBalance(balance);
125
122
  }
@@ -189,8 +189,8 @@ packages:
189
189
  dependency: "direct main"
190
190
  description:
191
191
  path: "packages/flet"
192
- ref: v1
193
- resolved-ref: f76d1c5dd805ec81a5a5d63300d61413a5bf27ae
192
+ ref: main
193
+ resolved-ref: b996d06ff462b88f5b31d6cceafac34ea6f57968
194
194
  url: "https://github.com/flet-dev/flet.git"
195
195
  source: git
196
196
  version: "0.70.0"
@@ -14,9 +14,9 @@ dependencies:
14
14
  audioplayers: ^6.4.0
15
15
  flet:
16
16
  git:
17
- path: packages/flet
18
- ref: v1
19
17
  url: https://github.com/flet-dev/flet.git
18
+ path: packages/flet
19
+ ref: main
20
20
  dev_dependencies:
21
21
  flutter_test:
22
22
  sdk: flutter
@@ -1 +0,0 @@
1
- flet>=0.70.0