flet-video 0.1.0__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-video might be problematic. Click here for more details.
- flet_video-0.1.0/PKG-INFO +170 -0
- flet_video-0.1.0/README.md +156 -0
- flet_video-0.1.0/pyproject.toml +36 -0
- flet_video-0.1.0/setup.cfg +4 -0
- flet_video-0.1.0/src/flet_video/__init__.py +7 -0
- flet_video-0.1.0/src/flet_video/video.py +552 -0
- flet_video-0.1.0/src/flet_video.egg-info/PKG-INFO +170 -0
- flet_video-0.1.0/src/flet_video.egg-info/SOURCES.txt +19 -0
- flet_video-0.1.0/src/flet_video.egg-info/dependency_links.txt +1 -0
- flet_video-0.1.0/src/flet_video.egg-info/requires.txt +1 -0
- flet_video-0.1.0/src/flet_video.egg-info/top_level.txt +2 -0
- flet_video-0.1.0/src/flutter/flet_video/CHANGELOG.md +3 -0
- flet_video-0.1.0/src/flutter/flet_video/LICENSE +201 -0
- flet_video-0.1.0/src/flutter/flet_video/README.md +3 -0
- flet_video-0.1.0/src/flutter/flet_video/analysis_options.yaml +4 -0
- flet_video-0.1.0/src/flutter/flet_video/lib/flet_video.dart +3 -0
- flet_video-0.1.0/src/flutter/flet_video/lib/src/create_control.dart +18 -0
- flet_video-0.1.0/src/flutter/flet_video/lib/src/utils/video.dart +121 -0
- flet_video-0.1.0/src/flutter/flet_video/lib/src/video.dart +291 -0
- flet_video-0.1.0/src/flutter/flet_video/pubspec.lock +967 -0
- flet_video-0.1.0/src/flutter/flet_video/pubspec.yaml +20 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: flet-video
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Video 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/video
|
|
8
|
+
Project-URL: Repository, https://github.com/flet-dev/flet-video
|
|
9
|
+
Project-URL: Issues, https://github.com/flet-dev/flet-video/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.1
|
|
14
|
+
|
|
15
|
+
# Flet Video control
|
|
16
|
+
|
|
17
|
+
`Video` control for Flet.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Add `flet-video` as dependency (`pyproject.toml` or `requirements.txt`) to your Flet project.
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
```py
|
|
26
|
+
import random
|
|
27
|
+
|
|
28
|
+
import flet as ft
|
|
29
|
+
|
|
30
|
+
import flet_video as ftv
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def main(page: ft.Page):
|
|
34
|
+
page.theme_mode = ft.ThemeMode.LIGHT
|
|
35
|
+
page.title = "TheEthicalVideo"
|
|
36
|
+
page.window.always_on_top = True
|
|
37
|
+
page.spacing = 20
|
|
38
|
+
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
|
|
39
|
+
|
|
40
|
+
def handle_pause(e):
|
|
41
|
+
video.pause()
|
|
42
|
+
print("Video.pause()")
|
|
43
|
+
|
|
44
|
+
def handle_play_or_pause(e):
|
|
45
|
+
video.play_or_pause()
|
|
46
|
+
print("Video.play_or_pause()")
|
|
47
|
+
|
|
48
|
+
def handle_play(e):
|
|
49
|
+
video.play()
|
|
50
|
+
print("Video.play()")
|
|
51
|
+
|
|
52
|
+
def handle_stop(e):
|
|
53
|
+
video.stop()
|
|
54
|
+
print("Video.stop()")
|
|
55
|
+
|
|
56
|
+
def handle_next(e):
|
|
57
|
+
video.next()
|
|
58
|
+
print("Video.next()")
|
|
59
|
+
|
|
60
|
+
def handle_previous(e):
|
|
61
|
+
video.previous()
|
|
62
|
+
print("Video.previous()")
|
|
63
|
+
|
|
64
|
+
def handle_volume_change(e):
|
|
65
|
+
video.volume = e.control.value
|
|
66
|
+
page.update()
|
|
67
|
+
print(f"Video.volume = {e.control.value}")
|
|
68
|
+
|
|
69
|
+
def handle_playback_rate_change(e):
|
|
70
|
+
video.playback_rate = e.control.value
|
|
71
|
+
page.update()
|
|
72
|
+
print(f"Video.playback_rate = {e.control.value}")
|
|
73
|
+
|
|
74
|
+
def handle_seek(e):
|
|
75
|
+
video.seek(10000)
|
|
76
|
+
print(f"Video.seek(10000)")
|
|
77
|
+
|
|
78
|
+
def handle_add_media(e):
|
|
79
|
+
video.playlist_add(random.choice(sample_media))
|
|
80
|
+
print(f"Video.playlist_add(random.choice(sample_media))")
|
|
81
|
+
|
|
82
|
+
def handle_remove_media(e):
|
|
83
|
+
r = random.randint(0, len(video.playlist) - 1)
|
|
84
|
+
video.playlist_remove(r)
|
|
85
|
+
print(f"Popped Item at index: {r} (position {r+1})")
|
|
86
|
+
|
|
87
|
+
def handle_jump(e):
|
|
88
|
+
print(f"Video.jump_to(0)")
|
|
89
|
+
video.jump_to(0)
|
|
90
|
+
|
|
91
|
+
sample_media = [
|
|
92
|
+
ftv.VideoMedia(
|
|
93
|
+
"https://user-images.githubusercontent.com/28951144/229373720-14d69157-1a56-4a78-a2f4-d7a134d7c3e9.mp4"
|
|
94
|
+
),
|
|
95
|
+
ftv.VideoMedia(
|
|
96
|
+
"https://user-images.githubusercontent.com/28951144/229373718-86ce5e1d-d195-45d5-baa6-ef94041d0b90.mp4"
|
|
97
|
+
),
|
|
98
|
+
ftv.VideoMedia(
|
|
99
|
+
"https://user-images.githubusercontent.com/28951144/229373716-76da0a4e-225a-44e4-9ee7-3e9006dbc3e3.mp4"
|
|
100
|
+
),
|
|
101
|
+
ftv.VideoMedia(
|
|
102
|
+
"https://user-images.githubusercontent.com/28951144/229373695-22f88f13-d18f-4288-9bf1-c3e078d83722.mp4"
|
|
103
|
+
),
|
|
104
|
+
ftv.VideoMedia(
|
|
105
|
+
"https://user-images.githubusercontent.com/28951144/229373709-603a7a89-2105-4e1b-a5a5-a6c3567c9a59.mp4",
|
|
106
|
+
extras={
|
|
107
|
+
"artist": "Thousand Foot Krutch",
|
|
108
|
+
"album": "The End Is Where We Begin",
|
|
109
|
+
},
|
|
110
|
+
http_headers={
|
|
111
|
+
"Foo": "Bar",
|
|
112
|
+
"Accept": "*/*",
|
|
113
|
+
},
|
|
114
|
+
),
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
page.add(
|
|
118
|
+
video := ftv.Video(
|
|
119
|
+
expand=True,
|
|
120
|
+
playlist=sample_media[0:2],
|
|
121
|
+
playlist_mode=ftv.PlaylistMode.LOOP,
|
|
122
|
+
fill_color=ft.Colors.BLUE_400,
|
|
123
|
+
aspect_ratio=16 / 9,
|
|
124
|
+
volume=100,
|
|
125
|
+
autoplay=False,
|
|
126
|
+
filter_quality=ft.FilterQuality.HIGH,
|
|
127
|
+
muted=False,
|
|
128
|
+
on_loaded=lambda e: print("Video loaded successfully!"),
|
|
129
|
+
on_enter_fullscreen=lambda e: print("Video entered fullscreen!"),
|
|
130
|
+
on_exit_fullscreen=lambda e: print("Video exited fullscreen!"),
|
|
131
|
+
),
|
|
132
|
+
ft.Row(
|
|
133
|
+
wrap=True,
|
|
134
|
+
alignment=ft.MainAxisAlignment.CENTER,
|
|
135
|
+
controls=[
|
|
136
|
+
ft.ElevatedButton("Play", on_click=handle_play),
|
|
137
|
+
ft.ElevatedButton("Pause", on_click=handle_pause),
|
|
138
|
+
ft.ElevatedButton("Play Or Pause", on_click=handle_play_or_pause),
|
|
139
|
+
ft.ElevatedButton("Stop", on_click=handle_stop),
|
|
140
|
+
ft.ElevatedButton("Next", on_click=handle_next),
|
|
141
|
+
ft.ElevatedButton("Previous", on_click=handle_previous),
|
|
142
|
+
ft.ElevatedButton("Seek s=10", on_click=handle_seek),
|
|
143
|
+
ft.ElevatedButton("Jump to first Media", on_click=handle_jump),
|
|
144
|
+
ft.ElevatedButton("Add Random Media", on_click=handle_add_media),
|
|
145
|
+
ft.ElevatedButton("Remove Random Media", on_click=handle_remove_media),
|
|
146
|
+
],
|
|
147
|
+
),
|
|
148
|
+
ft.Slider(
|
|
149
|
+
min=0,
|
|
150
|
+
value=100,
|
|
151
|
+
max=100,
|
|
152
|
+
label="Volume = {value}%",
|
|
153
|
+
divisions=10,
|
|
154
|
+
width=400,
|
|
155
|
+
on_change=handle_volume_change,
|
|
156
|
+
),
|
|
157
|
+
ft.Slider(
|
|
158
|
+
min=1,
|
|
159
|
+
value=1,
|
|
160
|
+
max=3,
|
|
161
|
+
label="PlaybackRate = {value}X",
|
|
162
|
+
divisions=6,
|
|
163
|
+
width=400,
|
|
164
|
+
on_change=handle_playback_rate_change,
|
|
165
|
+
),
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
ft.app(main)
|
|
170
|
+
```
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Flet Video control
|
|
2
|
+
|
|
3
|
+
`Video` control for Flet.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Add `flet-video` as dependency (`pyproject.toml` or `requirements.txt`) to your Flet project.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```py
|
|
12
|
+
import random
|
|
13
|
+
|
|
14
|
+
import flet as ft
|
|
15
|
+
|
|
16
|
+
import flet_video as ftv
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main(page: ft.Page):
|
|
20
|
+
page.theme_mode = ft.ThemeMode.LIGHT
|
|
21
|
+
page.title = "TheEthicalVideo"
|
|
22
|
+
page.window.always_on_top = True
|
|
23
|
+
page.spacing = 20
|
|
24
|
+
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
|
|
25
|
+
|
|
26
|
+
def handle_pause(e):
|
|
27
|
+
video.pause()
|
|
28
|
+
print("Video.pause()")
|
|
29
|
+
|
|
30
|
+
def handle_play_or_pause(e):
|
|
31
|
+
video.play_or_pause()
|
|
32
|
+
print("Video.play_or_pause()")
|
|
33
|
+
|
|
34
|
+
def handle_play(e):
|
|
35
|
+
video.play()
|
|
36
|
+
print("Video.play()")
|
|
37
|
+
|
|
38
|
+
def handle_stop(e):
|
|
39
|
+
video.stop()
|
|
40
|
+
print("Video.stop()")
|
|
41
|
+
|
|
42
|
+
def handle_next(e):
|
|
43
|
+
video.next()
|
|
44
|
+
print("Video.next()")
|
|
45
|
+
|
|
46
|
+
def handle_previous(e):
|
|
47
|
+
video.previous()
|
|
48
|
+
print("Video.previous()")
|
|
49
|
+
|
|
50
|
+
def handle_volume_change(e):
|
|
51
|
+
video.volume = e.control.value
|
|
52
|
+
page.update()
|
|
53
|
+
print(f"Video.volume = {e.control.value}")
|
|
54
|
+
|
|
55
|
+
def handle_playback_rate_change(e):
|
|
56
|
+
video.playback_rate = e.control.value
|
|
57
|
+
page.update()
|
|
58
|
+
print(f"Video.playback_rate = {e.control.value}")
|
|
59
|
+
|
|
60
|
+
def handle_seek(e):
|
|
61
|
+
video.seek(10000)
|
|
62
|
+
print(f"Video.seek(10000)")
|
|
63
|
+
|
|
64
|
+
def handle_add_media(e):
|
|
65
|
+
video.playlist_add(random.choice(sample_media))
|
|
66
|
+
print(f"Video.playlist_add(random.choice(sample_media))")
|
|
67
|
+
|
|
68
|
+
def handle_remove_media(e):
|
|
69
|
+
r = random.randint(0, len(video.playlist) - 1)
|
|
70
|
+
video.playlist_remove(r)
|
|
71
|
+
print(f"Popped Item at index: {r} (position {r+1})")
|
|
72
|
+
|
|
73
|
+
def handle_jump(e):
|
|
74
|
+
print(f"Video.jump_to(0)")
|
|
75
|
+
video.jump_to(0)
|
|
76
|
+
|
|
77
|
+
sample_media = [
|
|
78
|
+
ftv.VideoMedia(
|
|
79
|
+
"https://user-images.githubusercontent.com/28951144/229373720-14d69157-1a56-4a78-a2f4-d7a134d7c3e9.mp4"
|
|
80
|
+
),
|
|
81
|
+
ftv.VideoMedia(
|
|
82
|
+
"https://user-images.githubusercontent.com/28951144/229373718-86ce5e1d-d195-45d5-baa6-ef94041d0b90.mp4"
|
|
83
|
+
),
|
|
84
|
+
ftv.VideoMedia(
|
|
85
|
+
"https://user-images.githubusercontent.com/28951144/229373716-76da0a4e-225a-44e4-9ee7-3e9006dbc3e3.mp4"
|
|
86
|
+
),
|
|
87
|
+
ftv.VideoMedia(
|
|
88
|
+
"https://user-images.githubusercontent.com/28951144/229373695-22f88f13-d18f-4288-9bf1-c3e078d83722.mp4"
|
|
89
|
+
),
|
|
90
|
+
ftv.VideoMedia(
|
|
91
|
+
"https://user-images.githubusercontent.com/28951144/229373709-603a7a89-2105-4e1b-a5a5-a6c3567c9a59.mp4",
|
|
92
|
+
extras={
|
|
93
|
+
"artist": "Thousand Foot Krutch",
|
|
94
|
+
"album": "The End Is Where We Begin",
|
|
95
|
+
},
|
|
96
|
+
http_headers={
|
|
97
|
+
"Foo": "Bar",
|
|
98
|
+
"Accept": "*/*",
|
|
99
|
+
},
|
|
100
|
+
),
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
page.add(
|
|
104
|
+
video := ftv.Video(
|
|
105
|
+
expand=True,
|
|
106
|
+
playlist=sample_media[0:2],
|
|
107
|
+
playlist_mode=ftv.PlaylistMode.LOOP,
|
|
108
|
+
fill_color=ft.Colors.BLUE_400,
|
|
109
|
+
aspect_ratio=16 / 9,
|
|
110
|
+
volume=100,
|
|
111
|
+
autoplay=False,
|
|
112
|
+
filter_quality=ft.FilterQuality.HIGH,
|
|
113
|
+
muted=False,
|
|
114
|
+
on_loaded=lambda e: print("Video loaded successfully!"),
|
|
115
|
+
on_enter_fullscreen=lambda e: print("Video entered fullscreen!"),
|
|
116
|
+
on_exit_fullscreen=lambda e: print("Video exited fullscreen!"),
|
|
117
|
+
),
|
|
118
|
+
ft.Row(
|
|
119
|
+
wrap=True,
|
|
120
|
+
alignment=ft.MainAxisAlignment.CENTER,
|
|
121
|
+
controls=[
|
|
122
|
+
ft.ElevatedButton("Play", on_click=handle_play),
|
|
123
|
+
ft.ElevatedButton("Pause", on_click=handle_pause),
|
|
124
|
+
ft.ElevatedButton("Play Or Pause", on_click=handle_play_or_pause),
|
|
125
|
+
ft.ElevatedButton("Stop", on_click=handle_stop),
|
|
126
|
+
ft.ElevatedButton("Next", on_click=handle_next),
|
|
127
|
+
ft.ElevatedButton("Previous", on_click=handle_previous),
|
|
128
|
+
ft.ElevatedButton("Seek s=10", on_click=handle_seek),
|
|
129
|
+
ft.ElevatedButton("Jump to first Media", on_click=handle_jump),
|
|
130
|
+
ft.ElevatedButton("Add Random Media", on_click=handle_add_media),
|
|
131
|
+
ft.ElevatedButton("Remove Random Media", on_click=handle_remove_media),
|
|
132
|
+
],
|
|
133
|
+
),
|
|
134
|
+
ft.Slider(
|
|
135
|
+
min=0,
|
|
136
|
+
value=100,
|
|
137
|
+
max=100,
|
|
138
|
+
label="Volume = {value}%",
|
|
139
|
+
divisions=10,
|
|
140
|
+
width=400,
|
|
141
|
+
on_change=handle_volume_change,
|
|
142
|
+
),
|
|
143
|
+
ft.Slider(
|
|
144
|
+
min=1,
|
|
145
|
+
value=1,
|
|
146
|
+
max=3,
|
|
147
|
+
label="PlaybackRate = {value}X",
|
|
148
|
+
divisions=6,
|
|
149
|
+
width=400,
|
|
150
|
+
on_change=handle_playback_rate_change,
|
|
151
|
+
),
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
ft.app(main)
|
|
156
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "flet-video"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Video control for Flet"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Flet contributors", email = "hello@flet.dev" }
|
|
8
|
+
]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"License :: OSI Approved :: Apache Software License",
|
|
11
|
+
]
|
|
12
|
+
requires-python = ">=3.8"
|
|
13
|
+
dependencies = [
|
|
14
|
+
"flet>=0.25.1",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://flet.dev"
|
|
19
|
+
Documentation = "https://flet.dev/docs/controls/video"
|
|
20
|
+
Repository = "https://github.com/flet-dev/flet-video"
|
|
21
|
+
Issues = "https://github.com/flet-dev/flet-video/issues"
|
|
22
|
+
|
|
23
|
+
[tool.setuptools.package-data]
|
|
24
|
+
"flutter.flet_video" = ["**/*"]
|
|
25
|
+
|
|
26
|
+
[tool.uv]
|
|
27
|
+
dev-dependencies = [
|
|
28
|
+
"flet[all]>=0.25.1",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[tool.setuptools]
|
|
32
|
+
license-files = []
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["setuptools"]
|
|
36
|
+
build-backend = "setuptools.build_meta"
|