-
Notifications
You must be signed in to change notification settings - Fork 613
flet-video: add mpv_properties to VideoConfiguration #6041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b0aabfd
6d2c75b
1e2141a
2d55e8f
0b375ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,27 @@ class _VideoControlState extends State<VideoControl> with FletStoreMixin { | |||||||||||||||||||||||||||||||||||||||||||||
| late VideoController _controller; | ||||||||||||||||||||||||||||||||||||||||||||||
| bool _initialized = false; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| Future<void> _applyMpvProperties(Control control) async { | ||||||||||||||||||||||||||||||||||||||||||||||
| final cfg = control.get("configuration"); | ||||||||||||||||||||||||||||||||||||||||||||||
| if (cfg is! Map) return; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| final mpvPropsRaw = cfg["mpv_properties"]; | ||||||||||||||||||||||||||||||||||||||||||||||
| if (mpvPropsRaw is! Map) return; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| final platform = _player.platform; | ||||||||||||||||||||||||||||||||||||||||||||||
| if (platform is! NativePlayer) return; | ||||||||||||||||||||||||||||||||||||||||||||||
| final native = platform as dynamic; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| for (final entry in mpvPropsRaw.entries) { | ||||||||||||||||||||||||||||||||||||||||||||||
| final key = entry.key.toString(); | ||||||||||||||||||||||||||||||||||||||||||||||
| final val = entry.value; | ||||||||||||||||||||||||||||||||||||||||||||||
| if (val == null) continue; | ||||||||||||||||||||||||||||||||||||||||||||||
| final valueStr = val is bool ? (val ? "yes" : "no") : val.toString(); | ||||||||||||||||||||||||||||||||||||||||||||||
| await native.setProperty(key, valueStr); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+37
to
+44
|
||||||||||||||||||||||||||||||||||||||||||||||
| final native = platform as dynamic; | |
| for (final entry in mpvPropsRaw.entries) { | |
| final key = entry.key.toString(); | |
| final val = entry.value; | |
| if (val == null) continue; | |
| final valueStr = val is bool ? (val ? "yes" : "no") : val.toString(); | |
| await native.setProperty(key, valueStr); | |
| final native = platform; | |
| for (final entry in mpvPropsRaw.entries) { | |
| final key = entry.key.toString(); | |
| final val = entry.value; | |
| if (val == null) continue; | |
| final valueStr = val is bool ? (val ? "yes" : "no") : val.toString(); | |
| try { | |
| await (native as dynamic).setProperty(key, valueStr); | |
| } catch (e, stackTrace) { | |
| debugPrint( | |
| 'Error setting MPV property "$key" to "$valueStr": $e\n$stackTrace', | |
| ); | |
| } |
Uh oh!
There was an error while loading. Please reload this page.