flet-audio 0.2.0.dev51__tar.gz → 0.2.0.dev67__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.
- {flet_audio-0.2.0.dev51/src/flet_audio.egg-info → flet_audio-0.2.0.dev67}/PKG-INFO +6 -4
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/README.md +5 -3
- flet_audio-0.2.0.dev67/pyproject.toml +97 -0
- flet_audio-0.2.0.dev67/src/flet_audio/__init__.py +17 -0
- flet_audio-0.2.0.dev67/src/flet_audio/audio.py +233 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flet_audio/types.py +14 -9
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67/src/flet_audio.egg-info}/PKG-INFO +6 -4
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/pubspec.lock +56 -40
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/pubspec.yaml +1 -1
- flet_audio-0.2.0.dev51/pyproject.toml +0 -71
- flet_audio-0.2.0.dev51/src/flet_audio/__init__.py +0 -7
- flet_audio-0.2.0.dev51/src/flet_audio/audio.py +0 -278
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/LICENSE +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/setup.cfg +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flet_audio.egg-info/SOURCES.txt +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flet_audio.egg-info/dependency_links.txt +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flet_audio.egg-info/requires.txt +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flet_audio.egg-info/top_level.txt +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/CHANGELOG.md +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/LICENSE +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/README.md +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/analysis_options.yaml +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/lib/flet_audio.dart +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/lib/src/audio.dart +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/lib/src/extension.dart +0 -0
- {flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/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.
|
|
3
|
+
Version: 0.2.0.dev67
|
|
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
|
|
@@ -41,7 +41,9 @@ This package supports the following platforms:
|
|
|
41
41
|
| Android | ✅ |
|
|
42
42
|
| Web | ✅ |
|
|
43
43
|
|
|
44
|
-
##
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Installation
|
|
45
47
|
|
|
46
48
|
To install the `flet-audio` package and add it to your project dependencies:
|
|
47
49
|
|
|
@@ -61,6 +63,6 @@ To install the `flet-audio` package and add it to your project dependencies:
|
|
|
61
63
|
poetry add flet-audio
|
|
62
64
|
```
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
### Examples
|
|
65
67
|
|
|
66
|
-
For examples, see [
|
|
68
|
+
For examples, see [these](./examples).
|
|
@@ -25,7 +25,9 @@ This package supports the following platforms:
|
|
|
25
25
|
| Android | ✅ |
|
|
26
26
|
| Web | ✅ |
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Installation
|
|
29
31
|
|
|
30
32
|
To install the `flet-audio` package and add it to your project dependencies:
|
|
31
33
|
|
|
@@ -45,6 +47,6 @@ To install the `flet-audio` package and add it to your project dependencies:
|
|
|
45
47
|
poetry add flet-audio
|
|
46
48
|
```
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
### Examples
|
|
49
51
|
|
|
50
|
-
For examples, see [
|
|
52
|
+
For examples, see [these](./examples).
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "flet-audio"
|
|
3
|
+
version = "0.2.0.dev67"
|
|
4
|
+
description = "Eases audio integration and playback in Flet apps."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [{ name = "Flet contributors", email = "hello@flet.dev" }]
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
requires-python = ">=3.10"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"flet >=0.70.0.dev0",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
[project.urls]
|
|
14
|
+
Homepage = "https://flet.dev"
|
|
15
|
+
Documentation = "https://flet-dev.github.io/flet-audio"
|
|
16
|
+
Repository = "https://github.com/flet-dev/flet-audio"
|
|
17
|
+
Issues = "https://github.com/flet-dev/flet-audio/issues"
|
|
18
|
+
|
|
19
|
+
[tool.setuptools.package-data]
|
|
20
|
+
"flutter.flet_audio" = ["**/*"]
|
|
21
|
+
|
|
22
|
+
[dependency-groups]
|
|
23
|
+
test = [
|
|
24
|
+
"pytest >=7.2.0",
|
|
25
|
+
]
|
|
26
|
+
lint = [
|
|
27
|
+
"ruff >=0.11.7",
|
|
28
|
+
]
|
|
29
|
+
dev = [
|
|
30
|
+
"pre-commit >=4.2.0",
|
|
31
|
+
{ include-group = 'lint' },
|
|
32
|
+
{ include-group = 'test' },
|
|
33
|
+
]
|
|
34
|
+
docs-coverage = [
|
|
35
|
+
"docstr-coverage >=2.3.2",
|
|
36
|
+
]
|
|
37
|
+
docs = [
|
|
38
|
+
"mkdocs >=1.6.1",
|
|
39
|
+
"mkdocs-material >=9.6.15",
|
|
40
|
+
"mkdocstrings-python >=1.16.12",
|
|
41
|
+
"mkdocstrings-python-xref >=1.16.3",
|
|
42
|
+
"mike >=2.1.3",
|
|
43
|
+
"markdown >=3.6",
|
|
44
|
+
"pymdown-extensions >=10.16",
|
|
45
|
+
"mkdocs-exclude >=1.0.2",
|
|
46
|
+
"mkdocs-glightbox >=0.4.0",
|
|
47
|
+
"mkdocs-open-in-new-tab >=1.0.8",
|
|
48
|
+
"mkdocs-section-index >=0.3.10",
|
|
49
|
+
"griffe-modernized-annotations >=1.0.8",
|
|
50
|
+
"griffe-warnings-deprecated >=1.1.0",
|
|
51
|
+
"pygments >=2.16",
|
|
52
|
+
"markdown-exec[ansi] >=1.11.0",
|
|
53
|
+
"pydocstyle >=6.3.0",
|
|
54
|
+
"linkcheckmd >=1.4.0",
|
|
55
|
+
"mkdocs-external-images",
|
|
56
|
+
{ include-group = 'docs-coverage' },
|
|
57
|
+
]
|
|
58
|
+
all = [
|
|
59
|
+
{ include-group = 'dev' },
|
|
60
|
+
{ include-group = 'docs' },
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
[tool.uv.sources]
|
|
64
|
+
mkdocs-external-images = { git = "https://github.com/flet-dev/mkdocs-external-images", tag = "v0.2.0" }
|
|
65
|
+
|
|
66
|
+
[build-system]
|
|
67
|
+
requires = ["setuptools"]
|
|
68
|
+
build-backend = "setuptools.build_meta"
|
|
69
|
+
|
|
70
|
+
[tool.ruff]
|
|
71
|
+
line-length = 88
|
|
72
|
+
target-version = "py39"
|
|
73
|
+
fix = true
|
|
74
|
+
show-fixes = true
|
|
75
|
+
|
|
76
|
+
[tool.ruff.lint]
|
|
77
|
+
select = [
|
|
78
|
+
# pycodestyle
|
|
79
|
+
"E",
|
|
80
|
+
# Pyflakes
|
|
81
|
+
"F",
|
|
82
|
+
# pyupgrade
|
|
83
|
+
"UP",
|
|
84
|
+
# flake8-bugbear
|
|
85
|
+
"B",
|
|
86
|
+
# flake8-simplify
|
|
87
|
+
"SIM",
|
|
88
|
+
# isort
|
|
89
|
+
"I"
|
|
90
|
+
]
|
|
91
|
+
preview = true
|
|
92
|
+
pydocstyle = { convention = 'google' }
|
|
93
|
+
|
|
94
|
+
[tool.ruff.format]
|
|
95
|
+
quote-style = "double"
|
|
96
|
+
indent-style = "space"
|
|
97
|
+
line-ending = "auto"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from flet_audio.audio import Audio
|
|
2
|
+
from flet_audio.types import (
|
|
3
|
+
AudioDurationChangeEvent,
|
|
4
|
+
AudioPositionChangeEvent,
|
|
5
|
+
AudioState,
|
|
6
|
+
AudioStateChangeEvent,
|
|
7
|
+
ReleaseMode,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"Audio",
|
|
12
|
+
"AudioDurationChangeEvent",
|
|
13
|
+
"AudioPositionChangeEvent",
|
|
14
|
+
"AudioState",
|
|
15
|
+
"AudioStateChangeEvent",
|
|
16
|
+
"ReleaseMode",
|
|
17
|
+
]
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import flet as ft
|
|
4
|
+
|
|
5
|
+
from flet_audio.types import (
|
|
6
|
+
AudioDurationChangeEvent,
|
|
7
|
+
AudioPositionChangeEvent,
|
|
8
|
+
AudioStateChangeEvent,
|
|
9
|
+
ReleaseMode,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@ft.control("Audio")
|
|
14
|
+
class Audio(ft.Service):
|
|
15
|
+
"""
|
|
16
|
+
A control to simultaneously play multiple audio sources.
|
|
17
|
+
|
|
18
|
+
Raises:
|
|
19
|
+
AssertionError: If both [`src`][(c).] and [`src_base64`][(c).] are `None`.
|
|
20
|
+
|
|
21
|
+
Note:
|
|
22
|
+
This control is non-visual and should be added to
|
|
23
|
+
[`Page.services`][flet.Page.services]
|
|
24
|
+
list before it can be used.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
src: Optional[str] = None
|
|
28
|
+
"""
|
|
29
|
+
The audio source.
|
|
30
|
+
Can be a URL or a local [asset file](https://docs.flet.dev/cookbook/assets).
|
|
31
|
+
|
|
32
|
+
Note:
|
|
33
|
+
- At least one of `src` or [`src_base64`][flet_audio.Audio.src_base64] must be
|
|
34
|
+
provided, with `src_base64` having priority if both are provided.
|
|
35
|
+
- [Here](https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md#supported-formats--encodings)
|
|
36
|
+
is a list of supported audio formats.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
src_base64: Optional[str] = None
|
|
40
|
+
"""
|
|
41
|
+
Defines the contents of audio file encoded in base-64 format.
|
|
42
|
+
|
|
43
|
+
Note:
|
|
44
|
+
- At least one of [`src`][flet_audio.Audio.src] or `src_base64` must be
|
|
45
|
+
provided, with `src_base64` having priority if both are provided.
|
|
46
|
+
- [Here](https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md#supported-formats--encodings)
|
|
47
|
+
is a list of supported audio formats.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
autoplay: bool = False
|
|
51
|
+
"""
|
|
52
|
+
Starts playing audio as soon as audio control is added to a page.
|
|
53
|
+
|
|
54
|
+
Note:
|
|
55
|
+
Autoplay works in desktop, mobile apps and Safari browser,
|
|
56
|
+
but doesn't work in Chrome/Edge.
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
volume: ft.Number = 1.0
|
|
60
|
+
"""
|
|
61
|
+
Sets the volume (amplitude).
|
|
62
|
+
It's value ranges between `0.0` (mute) and `1.0` (maximum volume).
|
|
63
|
+
Intermediate values are linearly interpolated.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
balance: ft.Number = 0.0
|
|
67
|
+
"""
|
|
68
|
+
Defines the stereo balance.
|
|
69
|
+
|
|
70
|
+
* `-1` - The left channel is at full volume; the right channel is silent.
|
|
71
|
+
* `1` - The right channel is at full volume; the left channel is silent.
|
|
72
|
+
* `0` - Both channels are at the same volume.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
playback_rate: ft.Number = 1.0
|
|
76
|
+
"""
|
|
77
|
+
Defines the playback rate.
|
|
78
|
+
|
|
79
|
+
Should ideally be set when creating the constructor.
|
|
80
|
+
|
|
81
|
+
Note:
|
|
82
|
+
- iOS and macOS have limits between `0.5x` and `2x`.
|
|
83
|
+
- Android SDK version should be 23 or higher.
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
release_mode: ReleaseMode = ReleaseMode.RELEASE
|
|
87
|
+
"""
|
|
88
|
+
Defines the release mode.
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
on_loaded: Optional[ft.ControlEventHandler["Audio"]] = None
|
|
92
|
+
"""
|
|
93
|
+
Fires when an audio is loaded/buffered.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
on_duration_change: Optional[ft.EventHandler[AudioDurationChangeEvent]] = None
|
|
97
|
+
"""
|
|
98
|
+
Fires as soon as audio duration is available
|
|
99
|
+
(it might take a while to download or buffer it).
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
on_state_change: Optional[ft.EventHandler[AudioStateChangeEvent]] = None
|
|
103
|
+
"""
|
|
104
|
+
Fires when audio player state changes.
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
on_position_change: Optional[ft.EventHandler[AudioPositionChangeEvent]] = None
|
|
108
|
+
"""
|
|
109
|
+
Fires when audio position is changed.
|
|
110
|
+
Will continuously update the position of the playback
|
|
111
|
+
every 1 second if the status is playing.
|
|
112
|
+
|
|
113
|
+
Can be used for a progress bar.
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
on_seek_complete: Optional[ft.ControlEventHandler["Audio"]] = None
|
|
117
|
+
"""
|
|
118
|
+
Fires on seek completions.
|
|
119
|
+
An event is going to be sent as soon as the audio seek is finished.
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
def before_update(self):
|
|
123
|
+
super().before_update()
|
|
124
|
+
assert self.src or self.src_base64, "either src or src_base64 must be provided"
|
|
125
|
+
|
|
126
|
+
async def play(self, position: ft.DurationValue = 0, timeout: Optional[float] = 10):
|
|
127
|
+
"""
|
|
128
|
+
Starts playing audio from the specified `position`.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
position: The position to start playback from.
|
|
132
|
+
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
133
|
+
|
|
134
|
+
Raises:
|
|
135
|
+
TimeoutError: If the request times out.
|
|
136
|
+
"""
|
|
137
|
+
await self._invoke_method(
|
|
138
|
+
method_name="play",
|
|
139
|
+
arguments={"position": position},
|
|
140
|
+
timeout=timeout,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
async def pause(self, timeout: Optional[float] = 10):
|
|
144
|
+
"""
|
|
145
|
+
Pauses the audio that is currently playing.
|
|
146
|
+
|
|
147
|
+
If you call [`resume()`][flet_audio.Audio.resume] later,
|
|
148
|
+
the audio will resume from the point that it has been paused.
|
|
149
|
+
"""
|
|
150
|
+
await self._invoke_method("pause", timeout=timeout)
|
|
151
|
+
|
|
152
|
+
async def resume(self, timeout: Optional[float] = 10):
|
|
153
|
+
"""
|
|
154
|
+
Resumes the audio that has been paused or stopped.
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
158
|
+
|
|
159
|
+
Raises:
|
|
160
|
+
TimeoutError: If the request times out.
|
|
161
|
+
"""
|
|
162
|
+
await self._invoke_method("resume", timeout=timeout)
|
|
163
|
+
|
|
164
|
+
async def release(self, timeout: Optional[float] = 10):
|
|
165
|
+
"""
|
|
166
|
+
Releases the resources associated with this media player.
|
|
167
|
+
These are going to be fetched or buffered again as soon as
|
|
168
|
+
you change the source or call [`resume()`][flet_audio.Audio.resume].
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
172
|
+
|
|
173
|
+
Raises:
|
|
174
|
+
TimeoutError: If the request times out.
|
|
175
|
+
"""
|
|
176
|
+
await self._invoke_method("release", timeout=timeout)
|
|
177
|
+
|
|
178
|
+
async def seek(self, position: ft.DurationValue, timeout: Optional[float] = 10):
|
|
179
|
+
"""
|
|
180
|
+
Moves the cursor to the desired position.
|
|
181
|
+
|
|
182
|
+
Args:
|
|
183
|
+
position: The position to seek/move to.
|
|
184
|
+
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
185
|
+
|
|
186
|
+
Raises:
|
|
187
|
+
TimeoutError: If the request times out.
|
|
188
|
+
"""
|
|
189
|
+
await self._invoke_method(
|
|
190
|
+
method_name="seek",
|
|
191
|
+
arguments={"position": position},
|
|
192
|
+
timeout=timeout,
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
async def get_duration(
|
|
196
|
+
self, timeout: Optional[float] = 10
|
|
197
|
+
) -> Optional[ft.Duration]:
|
|
198
|
+
"""
|
|
199
|
+
Get audio duration of the audio playback.
|
|
200
|
+
|
|
201
|
+
It will be available as soon as the audio duration is available
|
|
202
|
+
(it might take a while to download or buffer it if file is not local).
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
The duration of audio playback.
|
|
209
|
+
|
|
210
|
+
Raises:
|
|
211
|
+
TimeoutError: If the request times out.
|
|
212
|
+
"""
|
|
213
|
+
return await self._invoke_method(
|
|
214
|
+
method_name="get_duration",
|
|
215
|
+
timeout=timeout,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
async def get_current_position(
|
|
219
|
+
self, timeout: Optional[float] = 10
|
|
220
|
+
) -> Optional[ft.Duration]:
|
|
221
|
+
"""
|
|
222
|
+
Get the current position of the audio playback.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
226
|
+
|
|
227
|
+
Returns:
|
|
228
|
+
The current position of the audio playback.
|
|
229
|
+
"""
|
|
230
|
+
return await self._invoke_method(
|
|
231
|
+
method_name="get_current_position",
|
|
232
|
+
timeout=timeout,
|
|
233
|
+
)
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
1
|
+
from dataclasses import dataclass
|
|
2
2
|
from enum import Enum
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
3
4
|
|
|
4
5
|
import flet as ft
|
|
5
6
|
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from flet_audio.audio import Audio # noqa
|
|
9
|
+
|
|
6
10
|
__all__ = [
|
|
11
|
+
"AudioDurationChangeEvent",
|
|
12
|
+
"AudioPositionChangeEvent",
|
|
7
13
|
"AudioState",
|
|
8
14
|
"AudioStateChangeEvent",
|
|
9
|
-
"AudioPositionChangeEvent",
|
|
10
|
-
"AudioDurationChangeEvent",
|
|
11
15
|
"ReleaseMode",
|
|
12
16
|
]
|
|
13
17
|
|
|
@@ -21,9 +25,10 @@ class ReleaseMode(Enum):
|
|
|
21
25
|
|
|
22
26
|
Info:
|
|
23
27
|
- On Android, the media player is quite resource-intensive, and this will
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- On iOS and macOS, works just like
|
|
28
|
+
let it go. Data will be buffered again when needed (if it's a remote file,
|
|
29
|
+
it will be downloaded again).
|
|
30
|
+
- On iOS and macOS, works just like
|
|
31
|
+
[`Audio.release()`][flet_audio.Audio.release] method.
|
|
27
32
|
"""
|
|
28
33
|
|
|
29
34
|
LOOP = "loop"
|
|
@@ -60,7 +65,7 @@ class AudioState(Enum):
|
|
|
60
65
|
|
|
61
66
|
|
|
62
67
|
@dataclass
|
|
63
|
-
class AudioStateChangeEvent(ft.Event[
|
|
68
|
+
class AudioStateChangeEvent(ft.Event["Audio"]):
|
|
64
69
|
"""
|
|
65
70
|
Event triggered when the audio playback state changes.
|
|
66
71
|
"""
|
|
@@ -70,7 +75,7 @@ class AudioStateChangeEvent(ft.Event[ft.EventControlType]):
|
|
|
70
75
|
|
|
71
76
|
|
|
72
77
|
@dataclass
|
|
73
|
-
class AudioPositionChangeEvent(ft.Event[
|
|
78
|
+
class AudioPositionChangeEvent(ft.Event["Audio"]):
|
|
74
79
|
"""
|
|
75
80
|
Event triggered when the audio playback position changes.
|
|
76
81
|
"""
|
|
@@ -80,7 +85,7 @@ class AudioPositionChangeEvent(ft.Event[ft.EventControlType]):
|
|
|
80
85
|
|
|
81
86
|
|
|
82
87
|
@dataclass
|
|
83
|
-
class AudioDurationChangeEvent(ft.Event[
|
|
88
|
+
class AudioDurationChangeEvent(ft.Event["Audio"]):
|
|
84
89
|
"""
|
|
85
90
|
Event triggered when the audio duration changes.
|
|
86
91
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flet-audio
|
|
3
|
-
Version: 0.2.0.
|
|
3
|
+
Version: 0.2.0.dev67
|
|
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
|
|
@@ -41,7 +41,9 @@ This package supports the following platforms:
|
|
|
41
41
|
| Android | ✅ |
|
|
42
42
|
| Web | ✅ |
|
|
43
43
|
|
|
44
|
-
##
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Installation
|
|
45
47
|
|
|
46
48
|
To install the `flet-audio` package and add it to your project dependencies:
|
|
47
49
|
|
|
@@ -61,6 +63,6 @@ To install the `flet-audio` package and add it to your project dependencies:
|
|
|
61
63
|
poetry add flet-audio
|
|
62
64
|
```
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
### Examples
|
|
65
67
|
|
|
66
|
-
For examples, see [
|
|
68
|
+
For examples, see [these](./examples).
|
|
@@ -13,10 +13,10 @@ packages:
|
|
|
13
13
|
dependency: transitive
|
|
14
14
|
description:
|
|
15
15
|
name: async
|
|
16
|
-
sha256:
|
|
16
|
+
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
|
|
17
17
|
url: "https://pub.dev"
|
|
18
18
|
source: hosted
|
|
19
|
-
version: "2.
|
|
19
|
+
version: "2.13.0"
|
|
20
20
|
audioplayers:
|
|
21
21
|
dependency: "direct main"
|
|
22
22
|
description:
|
|
@@ -121,6 +121,14 @@ packages:
|
|
|
121
121
|
url: "https://pub.dev"
|
|
122
122
|
source: hosted
|
|
123
123
|
version: "3.0.6"
|
|
124
|
+
dbus:
|
|
125
|
+
dependency: transitive
|
|
126
|
+
description:
|
|
127
|
+
name: dbus
|
|
128
|
+
sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c"
|
|
129
|
+
url: "https://pub.dev"
|
|
130
|
+
source: hosted
|
|
131
|
+
version: "0.7.11"
|
|
124
132
|
device_info_plus:
|
|
125
133
|
dependency: transitive
|
|
126
134
|
description:
|
|
@@ -149,10 +157,10 @@ packages:
|
|
|
149
157
|
dependency: transitive
|
|
150
158
|
description:
|
|
151
159
|
name: fake_async
|
|
152
|
-
sha256: "
|
|
160
|
+
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
|
|
153
161
|
url: "https://pub.dev"
|
|
154
162
|
source: hosted
|
|
155
|
-
version: "1.3.
|
|
163
|
+
version: "1.3.3"
|
|
156
164
|
ffi:
|
|
157
165
|
dependency: transitive
|
|
158
166
|
description:
|
|
@@ -173,10 +181,10 @@ packages:
|
|
|
173
181
|
dependency: transitive
|
|
174
182
|
description:
|
|
175
183
|
name: file_picker
|
|
176
|
-
sha256:
|
|
184
|
+
sha256: ef7d2a085c1b1d69d17b6842d0734aad90156de08df6bd3c12496d0bd6ddf8e2
|
|
177
185
|
url: "https://pub.dev"
|
|
178
186
|
source: hosted
|
|
179
|
-
version: "10.
|
|
187
|
+
version: "10.3.1"
|
|
180
188
|
fixnum:
|
|
181
189
|
dependency: transitive
|
|
182
190
|
description:
|
|
@@ -190,7 +198,7 @@ packages:
|
|
|
190
198
|
description:
|
|
191
199
|
path: "packages/flet"
|
|
192
200
|
ref: main
|
|
193
|
-
resolved-ref:
|
|
201
|
+
resolved-ref: "4ea9558543657d31dba3b11d6017beed2e16d447"
|
|
194
202
|
url: "https://github.com/flet-dev/flet.git"
|
|
195
203
|
source: git
|
|
196
204
|
version: "0.70.0"
|
|
@@ -211,10 +219,10 @@ packages:
|
|
|
211
219
|
dependency: "direct dev"
|
|
212
220
|
description:
|
|
213
221
|
name: flutter_lints
|
|
214
|
-
sha256:
|
|
222
|
+
sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
|
|
215
223
|
url: "https://pub.dev"
|
|
216
224
|
source: hosted
|
|
217
|
-
version: "
|
|
225
|
+
version: "3.0.2"
|
|
218
226
|
flutter_localizations:
|
|
219
227
|
dependency: transitive
|
|
220
228
|
description: flutter
|
|
@@ -232,10 +240,10 @@ packages:
|
|
|
232
240
|
dependency: transitive
|
|
233
241
|
description:
|
|
234
242
|
name: flutter_plugin_android_lifecycle
|
|
235
|
-
sha256:
|
|
243
|
+
sha256: "6382ce712ff69b0f719640ce957559dde459e55ecd433c767e06d139ddf16cab"
|
|
236
244
|
url: "https://pub.dev"
|
|
237
245
|
source: hosted
|
|
238
|
-
version: "2.0.
|
|
246
|
+
version: "2.0.29"
|
|
239
247
|
flutter_svg:
|
|
240
248
|
dependency: transitive
|
|
241
249
|
description:
|
|
@@ -282,10 +290,10 @@ packages:
|
|
|
282
290
|
dependency: transitive
|
|
283
291
|
description:
|
|
284
292
|
name: intl
|
|
285
|
-
sha256:
|
|
293
|
+
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
|
|
286
294
|
url: "https://pub.dev"
|
|
287
295
|
source: hosted
|
|
288
|
-
version: "0.
|
|
296
|
+
version: "0.20.2"
|
|
289
297
|
json_annotation:
|
|
290
298
|
dependency: transitive
|
|
291
299
|
description:
|
|
@@ -298,10 +306,10 @@ packages:
|
|
|
298
306
|
dependency: transitive
|
|
299
307
|
description:
|
|
300
308
|
name: leak_tracker
|
|
301
|
-
sha256:
|
|
309
|
+
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
|
|
302
310
|
url: "https://pub.dev"
|
|
303
311
|
source: hosted
|
|
304
|
-
version: "10.0.
|
|
312
|
+
version: "10.0.9"
|
|
305
313
|
leak_tracker_flutter_testing:
|
|
306
314
|
dependency: transitive
|
|
307
315
|
description:
|
|
@@ -322,10 +330,10 @@ packages:
|
|
|
322
330
|
dependency: transitive
|
|
323
331
|
description:
|
|
324
332
|
name: lints
|
|
325
|
-
sha256:
|
|
333
|
+
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
|
|
326
334
|
url: "https://pub.dev"
|
|
327
335
|
source: hosted
|
|
328
|
-
version: "
|
|
336
|
+
version: "3.0.0"
|
|
329
337
|
logging:
|
|
330
338
|
dependency: transitive
|
|
331
339
|
description:
|
|
@@ -418,10 +426,10 @@ packages:
|
|
|
418
426
|
dependency: transitive
|
|
419
427
|
description:
|
|
420
428
|
name: path_provider_foundation
|
|
421
|
-
sha256: "
|
|
429
|
+
sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd"
|
|
422
430
|
url: "https://pub.dev"
|
|
423
431
|
source: hosted
|
|
424
|
-
version: "2.4.
|
|
432
|
+
version: "2.4.2"
|
|
425
433
|
path_provider_linux:
|
|
426
434
|
dependency: transitive
|
|
427
435
|
description:
|
|
@@ -518,14 +526,22 @@ packages:
|
|
|
518
526
|
url: "https://pub.dev"
|
|
519
527
|
source: hosted
|
|
520
528
|
version: "0.2.0"
|
|
529
|
+
screenshot:
|
|
530
|
+
dependency: transitive
|
|
531
|
+
description:
|
|
532
|
+
name: screenshot
|
|
533
|
+
sha256: "63817697a7835e6ce82add4228e15d233b74d42975c143ad8cfe07009fab866b"
|
|
534
|
+
url: "https://pub.dev"
|
|
535
|
+
source: hosted
|
|
536
|
+
version: "3.0.0"
|
|
521
537
|
sensors_plus:
|
|
522
538
|
dependency: transitive
|
|
523
539
|
description:
|
|
524
540
|
name: sensors_plus
|
|
525
|
-
sha256: "
|
|
541
|
+
sha256: "89e2bfc3d883743539ce5774a2b93df61effde40ff958ecad78cd66b1a8b8d52"
|
|
526
542
|
url: "https://pub.dev"
|
|
527
543
|
source: hosted
|
|
528
|
-
version: "6.1.
|
|
544
|
+
version: "6.1.2"
|
|
529
545
|
sensors_plus_platform_interface:
|
|
530
546
|
dependency: transitive
|
|
531
547
|
description:
|
|
@@ -546,10 +562,10 @@ packages:
|
|
|
546
562
|
dependency: transitive
|
|
547
563
|
description:
|
|
548
564
|
name: shared_preferences_android
|
|
549
|
-
sha256: "
|
|
565
|
+
sha256: "5bcf0772a761b04f8c6bf814721713de6f3e5d9d89caf8d3fe031b02a342379e"
|
|
550
566
|
url: "https://pub.dev"
|
|
551
567
|
source: hosted
|
|
552
|
-
version: "2.4.
|
|
568
|
+
version: "2.4.11"
|
|
553
569
|
shared_preferences_foundation:
|
|
554
570
|
dependency: transitive
|
|
555
571
|
description:
|
|
@@ -639,10 +655,10 @@ packages:
|
|
|
639
655
|
dependency: transitive
|
|
640
656
|
description:
|
|
641
657
|
name: synchronized
|
|
642
|
-
sha256:
|
|
658
|
+
sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0
|
|
643
659
|
url: "https://pub.dev"
|
|
644
660
|
source: hosted
|
|
645
|
-
version: "3.
|
|
661
|
+
version: "3.4.0"
|
|
646
662
|
term_glyph:
|
|
647
663
|
dependency: transitive
|
|
648
664
|
description:
|
|
@@ -679,18 +695,18 @@ packages:
|
|
|
679
695
|
dependency: transitive
|
|
680
696
|
description:
|
|
681
697
|
name: url_launcher_android
|
|
682
|
-
sha256: "
|
|
698
|
+
sha256: "0aedad096a85b49df2e4725fa32118f9fa580f3b14af7a2d2221896a02cd5656"
|
|
683
699
|
url: "https://pub.dev"
|
|
684
700
|
source: hosted
|
|
685
|
-
version: "6.3.
|
|
701
|
+
version: "6.3.17"
|
|
686
702
|
url_launcher_ios:
|
|
687
703
|
dependency: transitive
|
|
688
704
|
description:
|
|
689
705
|
name: url_launcher_ios
|
|
690
|
-
sha256:
|
|
706
|
+
sha256: d80b3f567a617cb923546034cc94bfe44eb15f989fe670b37f26abdb9d939cb7
|
|
691
707
|
url: "https://pub.dev"
|
|
692
708
|
source: hosted
|
|
693
|
-
version: "6.3.
|
|
709
|
+
version: "6.3.4"
|
|
694
710
|
url_launcher_linux:
|
|
695
711
|
dependency: transitive
|
|
696
712
|
description:
|
|
@@ -703,10 +719,10 @@ packages:
|
|
|
703
719
|
dependency: transitive
|
|
704
720
|
description:
|
|
705
721
|
name: url_launcher_macos
|
|
706
|
-
sha256:
|
|
722
|
+
sha256: c043a77d6600ac9c38300567f33ef12b0ef4f4783a2c1f00231d2b1941fea13f
|
|
707
723
|
url: "https://pub.dev"
|
|
708
724
|
source: hosted
|
|
709
|
-
version: "3.2.
|
|
725
|
+
version: "3.2.3"
|
|
710
726
|
url_launcher_platform_interface:
|
|
711
727
|
dependency: transitive
|
|
712
728
|
description:
|
|
@@ -759,10 +775,10 @@ packages:
|
|
|
759
775
|
dependency: transitive
|
|
760
776
|
description:
|
|
761
777
|
name: vector_graphics_compiler
|
|
762
|
-
sha256:
|
|
778
|
+
sha256: ca81fdfaf62a5ab45d7296614aea108d2c7d0efca8393e96174bf4d51e6725b0
|
|
763
779
|
url: "https://pub.dev"
|
|
764
780
|
source: hosted
|
|
765
|
-
version: "1.1.
|
|
781
|
+
version: "1.1.18"
|
|
766
782
|
vector_math:
|
|
767
783
|
dependency: transitive
|
|
768
784
|
description:
|
|
@@ -775,10 +791,10 @@ packages:
|
|
|
775
791
|
dependency: transitive
|
|
776
792
|
description:
|
|
777
793
|
name: vm_service
|
|
778
|
-
sha256:
|
|
794
|
+
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
|
|
779
795
|
url: "https://pub.dev"
|
|
780
796
|
source: hosted
|
|
781
|
-
version: "
|
|
797
|
+
version: "15.0.0"
|
|
782
798
|
web:
|
|
783
799
|
dependency: transitive
|
|
784
800
|
description:
|
|
@@ -807,10 +823,10 @@ packages:
|
|
|
807
823
|
dependency: transitive
|
|
808
824
|
description:
|
|
809
825
|
name: win32
|
|
810
|
-
sha256: "
|
|
826
|
+
sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"
|
|
811
827
|
url: "https://pub.dev"
|
|
812
828
|
source: hosted
|
|
813
|
-
version: "5.
|
|
829
|
+
version: "5.14.0"
|
|
814
830
|
win32_registry:
|
|
815
831
|
dependency: transitive
|
|
816
832
|
description:
|
|
@@ -823,10 +839,10 @@ packages:
|
|
|
823
839
|
dependency: transitive
|
|
824
840
|
description:
|
|
825
841
|
name: window_manager
|
|
826
|
-
sha256: "
|
|
842
|
+
sha256: "7eb6d6c4164ec08e1bf978d6e733f3cebe792e2a23fb07cbca25c2872bfdbdcd"
|
|
827
843
|
url: "https://pub.dev"
|
|
828
844
|
source: hosted
|
|
829
|
-
version: "0.5.
|
|
845
|
+
version: "0.5.1"
|
|
830
846
|
window_to_front:
|
|
831
847
|
dependency: transitive
|
|
832
848
|
description:
|
|
@@ -852,5 +868,5 @@ packages:
|
|
|
852
868
|
source: hosted
|
|
853
869
|
version: "6.5.0"
|
|
854
870
|
sdks:
|
|
855
|
-
dart: ">=3.
|
|
871
|
+
dart: ">=3.8.0 <4.0.0"
|
|
856
872
|
flutter: ">=3.29.0"
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "flet-audio"
|
|
3
|
-
version = "0.2.0.dev51"
|
|
4
|
-
description = "Eases audio integration and playback in Flet apps."
|
|
5
|
-
readme = "README.md"
|
|
6
|
-
authors = [{ name = "Flet contributors", email = "hello@flet.dev" }]
|
|
7
|
-
license = "Apache-2.0"
|
|
8
|
-
requires-python = ">=3.10"
|
|
9
|
-
dependencies = [
|
|
10
|
-
"flet >=0.70.0.dev0",
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
[project.urls]
|
|
14
|
-
Homepage = "https://flet.dev"
|
|
15
|
-
Documentation = "https://flet-dev.github.io/flet-audio"
|
|
16
|
-
Repository = "https://github.com/flet-dev/flet-audio"
|
|
17
|
-
Issues = "https://github.com/flet-dev/flet-audio/issues"
|
|
18
|
-
|
|
19
|
-
[tool.setuptools.package-data]
|
|
20
|
-
"flutter.flet_audio" = ["**/*"]
|
|
21
|
-
|
|
22
|
-
[dependency-groups]
|
|
23
|
-
dev = [
|
|
24
|
-
"pre-commit>=4.2.0",
|
|
25
|
-
"ruff>=0.11.7",
|
|
26
|
-
]
|
|
27
|
-
docs = [
|
|
28
|
-
"mkdocs",
|
|
29
|
-
"mkdocs-material",
|
|
30
|
-
"mkdocstrings[python]",
|
|
31
|
-
"mkdocstrings-python-xref",
|
|
32
|
-
"mike",
|
|
33
|
-
"markdown>=3.6",
|
|
34
|
-
"pymdown-extensions",
|
|
35
|
-
"mkdocs-glightbox",
|
|
36
|
-
"mkdocs-section-index",
|
|
37
|
-
"griffe-modernized-annotations",
|
|
38
|
-
"pygments>=2.16",
|
|
39
|
-
]
|
|
40
|
-
|
|
41
|
-
[build-system]
|
|
42
|
-
requires = ["setuptools"]
|
|
43
|
-
build-backend = "setuptools.build_meta"
|
|
44
|
-
|
|
45
|
-
[tool.ruff]
|
|
46
|
-
line-length = 88
|
|
47
|
-
target-version = "py39"
|
|
48
|
-
fix = true
|
|
49
|
-
show-fixes = true
|
|
50
|
-
|
|
51
|
-
[tool.ruff.lint]
|
|
52
|
-
select = [
|
|
53
|
-
# pycodestyle
|
|
54
|
-
"E",
|
|
55
|
-
# Pyflakes
|
|
56
|
-
"F",
|
|
57
|
-
# pyupgrade
|
|
58
|
-
"UP",
|
|
59
|
-
# flake8-bugbear
|
|
60
|
-
"B",
|
|
61
|
-
# flake8-simplify
|
|
62
|
-
"SIM",
|
|
63
|
-
# isort
|
|
64
|
-
"I"
|
|
65
|
-
]
|
|
66
|
-
preview = true
|
|
67
|
-
|
|
68
|
-
[tool.ruff.format]
|
|
69
|
-
quote-style = "double"
|
|
70
|
-
indent-style = "space"
|
|
71
|
-
line-ending = "auto"
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
from typing import Optional
|
|
3
|
-
|
|
4
|
-
import flet as ft
|
|
5
|
-
|
|
6
|
-
from .types import (
|
|
7
|
-
AudioDurationChangeEvent,
|
|
8
|
-
AudioPositionChangeEvent,
|
|
9
|
-
AudioStateChangeEvent,
|
|
10
|
-
ReleaseMode,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@ft.control("Audio")
|
|
15
|
-
class Audio(ft.Service):
|
|
16
|
-
"""
|
|
17
|
-
A control to simultaneously play multiple audio sources.
|
|
18
|
-
|
|
19
|
-
Raises:
|
|
20
|
-
AssertionError: If both [`src`][(c).] and [`src_base64`][(c).] are `None`.
|
|
21
|
-
|
|
22
|
-
Note:
|
|
23
|
-
This control is non-visual and should be added to [`Page.services`][flet.Page.services]
|
|
24
|
-
list before it can be used.
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
src: Optional[str] = None
|
|
28
|
-
"""
|
|
29
|
-
The audio source. Can be a URL or a local [asset file](https://flet.dev/docs/cookbook/assets).
|
|
30
|
-
|
|
31
|
-
Note:
|
|
32
|
-
- At least one of `src` or [`src_base64`][..] must be provided,
|
|
33
|
-
with `src_base64` having priority if both are provided.
|
|
34
|
-
- [Here](https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md#supported-formats--encodings)
|
|
35
|
-
is a list of supported audio formats.
|
|
36
|
-
"""
|
|
37
|
-
|
|
38
|
-
src_base64: Optional[str] = None
|
|
39
|
-
"""
|
|
40
|
-
Defines the contents of audio file encoded in base-64 format.
|
|
41
|
-
|
|
42
|
-
Note:
|
|
43
|
-
- At least one of [`src`][..] or `src_base64` must be provided,
|
|
44
|
-
with `src_base64` having priority if both are provided.
|
|
45
|
-
- [Here](https://github.com/bluefireteam/audioplayers/blob/main/troubleshooting.md#supported-formats--encodings)
|
|
46
|
-
is a list of supported audio formats.
|
|
47
|
-
"""
|
|
48
|
-
|
|
49
|
-
autoplay: bool = False
|
|
50
|
-
"""
|
|
51
|
-
Starts playing audio as soon as audio control is added to a page.
|
|
52
|
-
|
|
53
|
-
Note:
|
|
54
|
-
Autoplay works in desktop, mobile apps and Safari browser, but doesn't work in Chrome/Edge.
|
|
55
|
-
"""
|
|
56
|
-
|
|
57
|
-
volume: ft.Number = 1.0
|
|
58
|
-
"""
|
|
59
|
-
Sets the volume (amplitude).
|
|
60
|
-
It's value ranges between `0.0` (mute) and `1.0` (maximum volume).
|
|
61
|
-
Intermediate values are linearly interpolated.
|
|
62
|
-
"""
|
|
63
|
-
|
|
64
|
-
balance: ft.Number = 0.0
|
|
65
|
-
"""
|
|
66
|
-
Defines the stereo balance.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
* `-1` - The left channel is at full volume; the right channel is silent.
|
|
70
|
-
* `1` - The right channel is at full volume; the left channel is silent.
|
|
71
|
-
* `0` - Both channels are at the same volume.
|
|
72
|
-
"""
|
|
73
|
-
|
|
74
|
-
playback_rate: ft.Number = 1.0
|
|
75
|
-
"""
|
|
76
|
-
Defines the playback rate.
|
|
77
|
-
|
|
78
|
-
Should ideally be set when creating the constructor.
|
|
79
|
-
|
|
80
|
-
Note:
|
|
81
|
-
- iOS and macOS have limits between `0.5x` and `2x`.
|
|
82
|
-
- Android SDK version should be 23 or higher.
|
|
83
|
-
"""
|
|
84
|
-
|
|
85
|
-
release_mode: ReleaseMode = ReleaseMode.RELEASE
|
|
86
|
-
"""
|
|
87
|
-
Defines the release mode.
|
|
88
|
-
"""
|
|
89
|
-
|
|
90
|
-
on_loaded: Optional[ft.ControlEventHandler["Audio"]] = None
|
|
91
|
-
"""
|
|
92
|
-
Fires when an audio is loaded/buffered.
|
|
93
|
-
"""
|
|
94
|
-
|
|
95
|
-
on_duration_change: Optional[ft.EventHandler[AudioDurationChangeEvent["Audio"]]] = None
|
|
96
|
-
"""
|
|
97
|
-
Fires as soon as audio duration is available (it might take a while to download or buffer it).
|
|
98
|
-
"""
|
|
99
|
-
|
|
100
|
-
on_state_change: Optional[ft.EventHandler[AudioStateChangeEvent["Audio"]]] = None
|
|
101
|
-
"""
|
|
102
|
-
Fires when audio player state changes.
|
|
103
|
-
"""
|
|
104
|
-
|
|
105
|
-
on_position_change: Optional[ft.EventHandler[AudioPositionChangeEvent["Audio"]]] = None
|
|
106
|
-
"""
|
|
107
|
-
Fires when audio position is changed.
|
|
108
|
-
Will continuously update the position of the playback every 1 second if the status is playing.
|
|
109
|
-
|
|
110
|
-
Can be used for a progress bar.
|
|
111
|
-
"""
|
|
112
|
-
|
|
113
|
-
on_seek_complete: Optional[ft.ControlEventHandler["Audio"]] = None
|
|
114
|
-
"""
|
|
115
|
-
Fires on seek completions.
|
|
116
|
-
An event is going to be sent as soon as the audio seek is finished.
|
|
117
|
-
"""
|
|
118
|
-
|
|
119
|
-
def before_update(self):
|
|
120
|
-
super().before_update()
|
|
121
|
-
assert self.src or self.src_base64, "either src or src_base64 must be provided"
|
|
122
|
-
|
|
123
|
-
async def play_async(self, position: ft.DurationValue = ft.Duration(), timeout: Optional[float] = 10):
|
|
124
|
-
"""
|
|
125
|
-
Starts playing audio from the specified `position`.
|
|
126
|
-
|
|
127
|
-
Args:
|
|
128
|
-
position: The position to start playback from.
|
|
129
|
-
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
130
|
-
|
|
131
|
-
Raises:
|
|
132
|
-
TimeoutError: If the request times out.
|
|
133
|
-
"""
|
|
134
|
-
await self._invoke_method_async("play", {"position": position}, timeout=timeout)
|
|
135
|
-
|
|
136
|
-
def play(self, position: ft.DurationValue = ft.Duration(), timeout: Optional[float] = 10):
|
|
137
|
-
"""
|
|
138
|
-
Starts playing audio from the specified `position`.
|
|
139
|
-
|
|
140
|
-
Args:
|
|
141
|
-
position: The position to start playback from.
|
|
142
|
-
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
143
|
-
|
|
144
|
-
Raises:
|
|
145
|
-
TimeoutError: If the request times out.
|
|
146
|
-
"""
|
|
147
|
-
asyncio.create_task(self.play_async(position, timeout=timeout))
|
|
148
|
-
|
|
149
|
-
async def pause_async(self, timeout: Optional[float] = 10):
|
|
150
|
-
"""
|
|
151
|
-
Pauses the audio that is currently playing.
|
|
152
|
-
|
|
153
|
-
If you call [`resume()`][(c).resume] or [`resume_async()`][(c).resume_async] later,
|
|
154
|
-
the audio will resume from the point that it has been paused.
|
|
155
|
-
"""
|
|
156
|
-
await self._invoke_method_async("pause", timeout=timeout)
|
|
157
|
-
|
|
158
|
-
def pause(self, timeout: Optional[float] = 10):
|
|
159
|
-
"""
|
|
160
|
-
Pauses the audio that is currently playing.
|
|
161
|
-
|
|
162
|
-
If you call [`resume()`][(c).resume] or [`resume_async()`][(c).resume_async] later,
|
|
163
|
-
the audio will resume from the point that it has been paused.
|
|
164
|
-
|
|
165
|
-
Args:
|
|
166
|
-
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
167
|
-
|
|
168
|
-
Raises:
|
|
169
|
-
TimeoutError: If the request times out.
|
|
170
|
-
"""
|
|
171
|
-
asyncio.create_task(self.pause_async(timeout=timeout))
|
|
172
|
-
|
|
173
|
-
async def resume_async(self, timeout: Optional[float] = 10):
|
|
174
|
-
"""
|
|
175
|
-
Resumes the audio that has been paused or stopped.
|
|
176
|
-
|
|
177
|
-
Args:
|
|
178
|
-
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
179
|
-
|
|
180
|
-
Raises:
|
|
181
|
-
TimeoutError: If the request times out.
|
|
182
|
-
"""
|
|
183
|
-
await self._invoke_method_async("resume", timeout=timeout)
|
|
184
|
-
|
|
185
|
-
def resume(self, timeout: Optional[float] = 10):
|
|
186
|
-
"""
|
|
187
|
-
Resumes the audio that has been paused or stopped.
|
|
188
|
-
|
|
189
|
-
Args:
|
|
190
|
-
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
191
|
-
|
|
192
|
-
Raises:
|
|
193
|
-
TimeoutError: If the request times out.
|
|
194
|
-
"""
|
|
195
|
-
asyncio.create_task(self.resume_async(timeout=timeout))
|
|
196
|
-
|
|
197
|
-
async def release_async(self, timeout: Optional[float] = 10):
|
|
198
|
-
"""
|
|
199
|
-
Releases the resources associated with this media player.
|
|
200
|
-
These are going to be fetched or buffered again as soon as
|
|
201
|
-
you change the source or call [`resume()`][(c).resume] or [`resume_async()`][(c).resume_async].
|
|
202
|
-
|
|
203
|
-
Args:
|
|
204
|
-
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
205
|
-
|
|
206
|
-
Raises:
|
|
207
|
-
TimeoutError: If the request times out.
|
|
208
|
-
"""
|
|
209
|
-
await self._invoke_method_async("release", timeout=timeout)
|
|
210
|
-
|
|
211
|
-
def release(self, timeout: Optional[float] = 10):
|
|
212
|
-
"""
|
|
213
|
-
Releases the resources associated with this media player.
|
|
214
|
-
These are going to be fetched or buffered again as soon as
|
|
215
|
-
you change the source or call [`resume()`][(c).resume] or [`resume_async()`][(c).resume_async].
|
|
216
|
-
|
|
217
|
-
Args:
|
|
218
|
-
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
219
|
-
|
|
220
|
-
Raises:
|
|
221
|
-
TimeoutError: If the request times out.
|
|
222
|
-
"""
|
|
223
|
-
asyncio.create_task(self.release_async(timeout=timeout))
|
|
224
|
-
|
|
225
|
-
async def seek_async(self, position: ft.DurationValue, timeout: Optional[float] = 10):
|
|
226
|
-
"""
|
|
227
|
-
Moves the cursor to the desired position.
|
|
228
|
-
|
|
229
|
-
Args:
|
|
230
|
-
position: The position to seek/move to.
|
|
231
|
-
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
232
|
-
|
|
233
|
-
Raises:
|
|
234
|
-
TimeoutError: If the request times out.
|
|
235
|
-
"""
|
|
236
|
-
await self._invoke_method_async("seek", {"position": position}, timeout=timeout)
|
|
237
|
-
|
|
238
|
-
def seek(self, position: ft.DurationValue, timeout: Optional[float] = 10):
|
|
239
|
-
"""
|
|
240
|
-
Moves the cursor to the desired position.
|
|
241
|
-
|
|
242
|
-
Args:
|
|
243
|
-
position: The position to seek/move to.
|
|
244
|
-
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
245
|
-
|
|
246
|
-
Raises:
|
|
247
|
-
TimeoutError: If the request times out.
|
|
248
|
-
"""
|
|
249
|
-
asyncio.create_task(self.seek_async(position, timeout=timeout))
|
|
250
|
-
|
|
251
|
-
async def get_duration_async(self, timeout: Optional[float] = 10) -> Optional[ft.Duration]:
|
|
252
|
-
"""
|
|
253
|
-
Get audio duration of the audio playback.
|
|
254
|
-
|
|
255
|
-
It will be available as soon as the audio duration is available
|
|
256
|
-
(it might take a while to download or buffer it if file is not local).
|
|
257
|
-
|
|
258
|
-
Args:
|
|
259
|
-
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
260
|
-
|
|
261
|
-
Returns:
|
|
262
|
-
The duration of audio playback.
|
|
263
|
-
|
|
264
|
-
Raises:
|
|
265
|
-
TimeoutError: If the request times out.
|
|
266
|
-
"""
|
|
267
|
-
return await self._invoke_method_async("get_duration", timeout=timeout)
|
|
268
|
-
|
|
269
|
-
async def get_current_position_async(self, timeout: Optional[float] = 10) -> Optional[ft.Duration]:
|
|
270
|
-
"""
|
|
271
|
-
Get the current position of the audio playback.
|
|
272
|
-
|
|
273
|
-
Args:
|
|
274
|
-
timeout: The maximum amount of time (in seconds) to wait for a response.
|
|
275
|
-
Returns:
|
|
276
|
-
The current position of the audio playback.
|
|
277
|
-
"""
|
|
278
|
-
return await self._invoke_method_async("get_current_position", timeout=timeout)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flet_audio.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/analysis_options.yaml
RENAMED
|
File without changes
|
{flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/lib/flet_audio.dart
RENAMED
|
File without changes
|
|
File without changes
|
{flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/lib/src/extension.dart
RENAMED
|
File without changes
|
{flet_audio-0.2.0.dev51 → flet_audio-0.2.0.dev67}/src/flutter/flet_audio/lib/src/utils/audio.dart
RENAMED
|
File without changes
|