flet-audio 0.2.0.dev42__py3-none-any.whl → 0.2.0.dev51__py3-none-any.whl
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.
- flet_audio/audio.py +27 -21
- flet_audio/types.py +23 -3
- {flet_audio-0.2.0.dev42.dist-info → flet_audio-0.2.0.dev51.dist-info}/METADATA +1 -1
- {flet_audio-0.2.0.dev42.dist-info → flet_audio-0.2.0.dev51.dist-info}/RECORD +8 -8
- flutter/flet_audio/lib/src/audio.dart +4 -7
- {flet_audio-0.2.0.dev42.dist-info → flet_audio-0.2.0.dev51.dist-info}/WHEEL +0 -0
- {flet_audio-0.2.0.dev42.dist-info → flet_audio-0.2.0.dev51.dist-info}/licenses/LICENSE +0 -0
- {flet_audio-0.2.0.dev42.dist-info → flet_audio-0.2.0.dev51.dist-info}/top_level.txt +0 -0
flet_audio/audio.py
CHANGED
|
@@ -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`
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
87
|
+
Defines the release mode.
|
|
87
88
|
"""
|
|
88
89
|
|
|
89
|
-
on_loaded: ft.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
"""
|
flet_audio/types.py
CHANGED
|
@@ -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
|
-
-
|
|
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
|
-
-
|
|
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
|
-
|
|
84
|
+
"""
|
|
85
|
+
Event triggered when the audio duration changes.
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
duration: ft.Duration
|
|
89
|
+
"""The duration of the audio."""
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
flet_audio/__init__.py,sha256=aLfmcJXT-xQPy6DAn-jQCh0fXRk5ji96Fg15PL5lo0E,151
|
|
2
|
-
flet_audio/audio.py,sha256=
|
|
3
|
-
flet_audio/types.py,sha256=
|
|
4
|
-
flet_audio-0.2.0.
|
|
2
|
+
flet_audio/audio.py,sha256=IaJ_nIp410ClXFZRTlhwOLvQv9xv2heuQikCjeXeNig,9444
|
|
3
|
+
flet_audio/types.py,sha256=YJ_RYQanID06LZ8q3APHcM7QBielawXNo5ft8Zi0VKw,2257
|
|
4
|
+
flet_audio-0.2.0.dev51.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
5
|
flutter/flet_audio/CHANGELOG.md,sha256=66sWepPaeTc9_lzcYIGU55AlxSU5Z1XVtknXpzd_-p8,40
|
|
6
6
|
flutter/flet_audio/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
7
7
|
flutter/flet_audio/README.md,sha256=BEITqZ4okarTGCquI4ii6tdffGm2qyxMkMZbsedCwLQ,60
|
|
@@ -9,10 +9,10 @@ flutter/flet_audio/analysis_options.yaml,sha256=32kjGAc-zF87inWaH5M46yGZWQDTwrwf
|
|
|
9
9
|
flutter/flet_audio/pubspec.lock,sha256=Rje88uBW7vkOXea40g_LPnX_P5pFO1r-3gE_5X3Mris,25471
|
|
10
10
|
flutter/flet_audio/pubspec.yaml,sha256=_lJ8tH_SgiuDKkYdpHOlzPYqNguX5mMlaEfZJbz_KFg,510
|
|
11
11
|
flutter/flet_audio/lib/flet_audio.dart,sha256=JsHEW9Gic_011jhKpnn278pi1kiWjp9gUjfNF5rWmXs,65
|
|
12
|
-
flutter/flet_audio/lib/src/audio.dart,sha256=
|
|
12
|
+
flutter/flet_audio/lib/src/audio.dart,sha256=ExGoAU9pIlR5z6ptVDXRMhD5NktkBljN9OgRy5InfIw,5108
|
|
13
13
|
flutter/flet_audio/lib/src/extension.dart,sha256=okI-bxwSUB9FwgJ7TmiiHcE5yi5z66Yp1ri--V1wVnw,299
|
|
14
14
|
flutter/flet_audio/lib/src/utils/audio.dart,sha256=Rpbf7xJkNB3xtwrfmXru1t2k3_TgPEnh3Ws6i_2J0EQ,346
|
|
15
|
-
flet_audio-0.2.0.
|
|
16
|
-
flet_audio-0.2.0.
|
|
17
|
-
flet_audio-0.2.0.
|
|
18
|
-
flet_audio-0.2.0.
|
|
15
|
+
flet_audio-0.2.0.dev51.dist-info/METADATA,sha256=lxqKNt7Aj8VEWIAyF6ub3_0DIkyjcBhHfvwyG05_Zoo,1935
|
|
16
|
+
flet_audio-0.2.0.dev51.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
17
|
+
flet_audio-0.2.0.dev51.dist-info/top_level.txt,sha256=hZbGOXppSiKRUWJf1ZRlBKMyfijq6Y-8DffGOh10Wq4,19
|
|
18
|
+
flet_audio-0.2.0.dev51.dist-info/RECORD,,
|
|
@@ -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 =
|
|
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
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|