flet-video 0.70.0.dev6491__py3-none-any.whl → 0.70.0.dev6561__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.
flet_video/video.py CHANGED
@@ -61,6 +61,13 @@ class Video(ft.LayoutControl):
61
61
  Whether to show the video player controls.
62
62
  """
63
63
 
64
+ fullscreen: bool = False
65
+ """
66
+ Whether the video player is presented in fullscreen mode.
67
+
68
+ Set to `True` to enter fullscreen or `False` to exit fullscreen programmatically.
69
+ """
70
+
64
71
  muted: bool = False
65
72
  """
66
73
  Defines whether the video player should be started in muted state.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet-video
3
- Version: 0.70.0.dev6491
3
+ Version: 0.70.0.dev6561
4
4
  Summary: Cross-platform video playback for 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/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.dev6491
14
+ Requires-Dist: flet==0.70.0.dev6561
15
15
  Dynamic: license-file
16
16
 
17
17
  # flet-video
@@ -1,18 +1,18 @@
1
1
  flet_video/__init__.py,sha256=33oTk8_ydccY8DZLPQiEViHrjLov53K7JYs92jamh_E,386
2
2
  flet_video/types.py,sha256=ZLw2pgVbmx60lskZpzIQlTsAzAXijf23p7jTVdpV80w,5328
3
- flet_video/video.py,sha256=YckuAWgv61Ifgij8pgmknYM7ZIlvsC-Jl6O75WcxGcc,8460
4
- flet_video-0.70.0.dev6491.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
+ flet_video/video.py,sha256=i3Myj5aKMfiaBDWgr1Lv205UELz-_gE4UypBDQdadLk,8655
4
+ flet_video-0.70.0.dev6561.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
5
  flutter/flet_video/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
6
6
  flutter/flet_video/analysis_options.yaml,sha256=32kjGAc-zF87inWaH5M46yGZWQDTwrwfvNLHeAocfG4,154
7
- flutter/flet_video/pubspec.lock,sha256=WGBWMTnl6xsdDTVeKzO9XxvF_BvGIvUdyQLMkJ3eEL4,29336
7
+ flutter/flet_video/pubspec.lock,sha256=4G2VMSWuFkV8PSJAaKas7gpPjdXczB5Z8DTt5FToqSE,29107
8
8
  flutter/flet_video/pubspec.yaml,sha256=xog0e_jpXc_EMv5diDvAlOnA0o0WIMYvnF3S8vPfVhw,411
9
9
  flutter/flet_video/lib/flet_video.dart,sha256=x-KG1v-Qb_AiSyH9Y2Jt9PIYPxl_mQjXeIg_BDEQ0iQ,65
10
10
  flutter/flet_video/lib/src/extension.dart,sha256=8a6XcgY0KD4HQVkSVx0_6O8WcCqUeVub0_ihq4WW7S4,477
11
- flutter/flet_video/lib/src/video.dart,sha256=Wlh61Rldan9hPmSxOcOVNPUoN7b8ii5ouv3QaavXeRk,7770
11
+ flutter/flet_video/lib/src/video.dart,sha256=iXJ861wdEPSkJpO06YX7gmc73WoXngD21geQvkNChLA,9109
12
12
  flutter/flet_video/lib/src/utils/file_utils_io.dart,sha256=7AgfFYmc2hWT3Hqra29zyl4H0y43L5ZnqvFoGuMPCpM,276
13
13
  flutter/flet_video/lib/src/utils/file_utils_web.dart,sha256=TeGP-wSeoe39G_EJO2JFhgw6lJXmDXBNW0i-YUgxlaw,138
14
14
  flutter/flet_video/lib/src/utils/video.dart,sha256=ictwd-7_8i7KmwGftHAhFFF_w2Y8vuXeeY4-bkfEhEk,4258
15
- flet_video-0.70.0.dev6491.dist-info/METADATA,sha256=tXOl_Cz9YEVUZN7E1pQUcLOtf2wOqSycQoyGin5Oa1I,2228
16
- flet_video-0.70.0.dev6491.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
- flet_video-0.70.0.dev6491.dist-info/top_level.txt,sha256=7omjcyZHBn3gldah0wrmAlkR9Vc1vmtSlhUVZcPg2o0,19
18
- flet_video-0.70.0.dev6491.dist-info/RECORD,,
15
+ flet_video-0.70.0.dev6561.dist-info/METADATA,sha256=svI7ABtbZvgj_96gjs39FIF45eBVtKEaGs-QhOSuNMY,2228
16
+ flet_video-0.70.0.dev6561.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
+ flet_video-0.70.0.dev6561.dist-info/top_level.txt,sha256=7omjcyZHBn3gldah0wrmAlkR9Vc1vmtSlhUVZcPg2o0,19
18
+ flet_video-0.70.0.dev6561.dist-info/RECORD,,
@@ -15,6 +15,7 @@ class VideoControl extends StatefulWidget {
15
15
  }
16
16
 
17
17
  class _VideoControlState extends State<VideoControl> with FletStoreMixin {
18
+ final GlobalKey<VideoState> _videoKey = GlobalKey<VideoState>();
18
19
  late final playerConfig = PlayerConfiguration(
19
20
  title: widget.control.getString("title", "flet-video")!,
20
21
  muted: widget.control.getBool("muted", false)!,
@@ -31,6 +32,24 @@ class _VideoControlState extends State<VideoControl> with FletStoreMixin {
31
32
  late final controller =
32
33
  VideoController(player, configuration: videoControllerConfiguration);
33
34
 
35
+ Future<void> _handleEnterFullscreen() async {
36
+ widget.control.updateProperties({"_fullscreen": true}, python: false);
37
+ if (!widget.control.getBool("fullscreen", false)!) {
38
+ widget.control.updateProperties({"fullscreen": true});
39
+ }
40
+ widget.control.triggerEvent("enter_fullscreen");
41
+ await defaultEnterNativeFullscreen();
42
+ }
43
+
44
+ Future<void> _handleExitFullscreen() async {
45
+ widget.control.updateProperties({"_fullscreen": false}, python: false);
46
+ if (widget.control.getBool("fullscreen", false)!) {
47
+ widget.control.updateProperties({"fullscreen": false});
48
+ }
49
+ widget.control.triggerEvent("exit_fullscreen");
50
+ await defaultExitNativeFullscreen();
51
+ }
52
+
34
53
  @override
35
54
  void initState() {
36
55
  super.initState();
@@ -107,7 +126,7 @@ class _VideoControlState extends State<VideoControl> with FletStoreMixin {
107
126
 
108
127
  @override
109
128
  Widget build(BuildContext context) {
110
- debugPrint("Video XXX build: ${widget.control.id}");
129
+ debugPrint("Video build: ${widget.control.id}");
111
130
 
112
131
  var subtitleConfiguration = parseSubtitleConfiguration(
113
132
  widget.control.get("subtitle_configuration"),
@@ -123,6 +142,7 @@ class _VideoControlState extends State<VideoControl> with FletStoreMixin {
123
142
  var showControls = widget.control.getBool("show_controls", true)!;
124
143
  var playlistMode =
125
144
  parsePlaylistMode(widget.control.getString("playlist_mode"));
145
+ var fullscreen = widget.control.getBool("fullscreen", false)!;
126
146
 
127
147
  // previous values
128
148
  final prevVolume = widget.control.getDouble("_volume");
@@ -132,8 +152,10 @@ class _VideoControlState extends State<VideoControl> with FletStoreMixin {
132
152
  final PlaylistMode? prevPlaylistMode = widget.control.get("_playlist_mode");
133
153
  final SubtitleTrack? prevSubtitleTrack =
134
154
  widget.control.get("_subtitleTrack");
155
+ final prevFullscreen = widget.control.getBool("_fullscreen", false)!;
135
156
 
136
157
  Video video = Video(
158
+ key: _videoKey,
137
159
  controller: controller,
138
160
  wakelock: widget.control.getBool("wakelock", true)!,
139
161
  controls: showControls ? AdaptiveVideoControls : null,
@@ -147,15 +169,12 @@ class _VideoControlState extends State<VideoControl> with FletStoreMixin {
147
169
  widget.control.getFilterQuality("filter_quality", FilterQuality.low)!,
148
170
  subtitleViewConfiguration: subtitleConfiguration,
149
171
  fill: widget.control.getColor("fill_color", context, Colors.black)!,
150
- onEnterFullscreen: widget.control.getBool("on_enter_fullscreen", false)!
151
- ? () async => widget.control.triggerEvent("enter_fullscreen")
152
- : defaultEnterNativeFullscreen,
153
- onExitFullscreen: widget.control.getBool("on_exit_fullscreen", false)!
154
- ? () async => widget.control.triggerEvent("exit_fullscreen")
155
- : defaultExitNativeFullscreen,
172
+ onEnterFullscreen: _handleEnterFullscreen,
173
+ onExitFullscreen: _handleExitFullscreen,
156
174
  );
157
175
 
158
176
  () async {
177
+ // volume
159
178
  if (volume != null &&
160
179
  volume != prevVolume &&
161
180
  volume >= 0 &&
@@ -164,34 +183,57 @@ class _VideoControlState extends State<VideoControl> with FletStoreMixin {
164
183
  await player.setVolume(volume);
165
184
  }
166
185
 
186
+ // pitch
167
187
  if (pitch != null && pitch != prevPitch) {
168
188
  widget.control.updateProperties({"_pitch": pitch}, python: false);
169
189
  await player.setPitch(pitch);
170
190
  }
171
191
 
192
+ // playbackRate
172
193
  if (playbackRate != null && playbackRate != prevPlaybackRate) {
173
194
  widget.control
174
195
  .updateProperties({"_playbackRate": playbackRate}, python: false);
175
196
  await player.setRate(playbackRate);
176
197
  }
177
198
 
199
+ // shufflePlaylist
178
200
  if (shufflePlaylist != null && shufflePlaylist != prevShufflePlaylist) {
179
201
  widget.control.updateProperties({"_shufflePlaylist": shufflePlaylist},
180
202
  python: false);
181
203
  await player.setShuffle(shufflePlaylist);
182
204
  }
183
205
 
206
+ // playlistMode
184
207
  if (playlistMode != null && playlistMode != prevPlaylistMode) {
185
208
  widget.control
186
209
  .updateProperties({"_playlistMode": playlistMode}, python: false);
187
210
  await player.setPlaylistMode(playlistMode);
188
211
  }
189
212
 
213
+ // subtitleTrack
190
214
  if (subtitleTrack != null && subtitleTrack != prevSubtitleTrack) {
191
215
  widget.control
192
216
  .updateProperties({"_subtitleTrack": subtitleTrack}, python: false);
193
217
  await player.setSubtitleTrack(subtitleTrack);
194
218
  }
219
+
220
+ // fullscreen
221
+ if (fullscreen != prevFullscreen) {
222
+ widget.control
223
+ .updateProperties({"_fullscreen": fullscreen}, python: false);
224
+ // Defer fullscreen transition until after this frame's build completes.
225
+ WidgetsBinding.instance.addPostFrameCallback((_) {
226
+ final videoState = _videoKey.currentState;
227
+ if (videoState == null) {
228
+ return;
229
+ }
230
+ if (fullscreen) {
231
+ videoState.enterFullscreen();
232
+ } else {
233
+ videoState.exitFullscreen();
234
+ }
235
+ });
236
+ }
195
237
  }();
196
238
 
197
239
  // listen to errors
@@ -61,18 +61,18 @@ packages:
61
61
  dependency: transitive
62
62
  description:
63
63
  name: cross_file
64
- sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670"
64
+ sha256: "942a4791cd385a68ccb3b32c71c427aba508a1bb949b86dff2adbe4049f16239"
65
65
  url: "https://pub.dev"
66
66
  source: hosted
67
- version: "0.3.4+2"
67
+ version: "0.3.5"
68
68
  crypto:
69
69
  dependency: transitive
70
70
  description:
71
71
  name: crypto
72
- sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855"
72
+ sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf
73
73
  url: "https://pub.dev"
74
74
  source: hosted
75
- version: "3.0.6"
75
+ version: "3.0.7"
76
76
  dbus:
77
77
  dependency: transitive
78
78
  description:
@@ -689,14 +689,6 @@ packages:
689
689
  url: "https://pub.dev"
690
690
  source: hosted
691
691
  version: "1.10.1"
692
- sprintf:
693
- dependency: transitive
694
- description:
695
- name: sprintf
696
- sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
697
- url: "https://pub.dev"
698
- source: hosted
699
- version: "7.0.0"
700
692
  stack_trace:
701
693
  dependency: transitive
702
694
  description:
@@ -837,10 +829,10 @@ packages:
837
829
  dependency: transitive
838
830
  description:
839
831
  name: uuid
840
- sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff
832
+ sha256: a11b666489b1954e01d992f3d601b1804a33937b5a8fe677bd26b8a9f96f96e8
841
833
  url: "https://pub.dev"
842
834
  source: hosted
843
- version: "4.5.1"
835
+ version: "4.5.2"
844
836
  vector_graphics:
845
837
  dependency: transitive
846
838
  description: