Skip to content

Commit f711004

Browse files
committed
add new video setting on Android to toggle hybrid composition
1 parent 1238867 commit f711004

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

lib/screens/channel/video/video.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class _VideoState extends State<Video> with WidgetsBindingObserver {
4848
return WebViewWidget.fromPlatformCreationParams(
4949
params: AndroidWebViewWidgetCreationParams(
5050
controller: widget.videoStore.videoWebViewController.platform,
51-
displayWithHybridComposition: true,
51+
displayWithHybridComposition:
52+
!widget.videoStore.settingsStore.useEnhancedRendering,
5253
),
5354
);
5455
} else {

lib/screens/settings/stores/settings_store.dart

+6
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ abstract class _SettingsStoreBase with Store {
6464
static const defaultShowVideo = true;
6565
static const defaultDefaultToHighestQuality = false;
6666
static const defaultShowLatency = true;
67+
static const defaultUseEnhancedRendering = false;
6768

6869
// Overlay defaults
6970
static const defaultShowOverlay = true;
@@ -83,6 +84,10 @@ abstract class _SettingsStoreBase with Store {
8384
@observable
8485
var showLatency = defaultShowLatency;
8586

87+
@JsonKey(defaultValue: defaultUseEnhancedRendering)
88+
@observable
89+
var useEnhancedRendering = defaultUseEnhancedRendering;
90+
8691
// Overlay options
8792
@JsonKey(defaultValue: defaultShowOverlay)
8893
@observable
@@ -101,6 +106,7 @@ abstract class _SettingsStoreBase with Store {
101106
showVideo = defaultShowVideo;
102107
defaultToHighestQuality = defaultDefaultToHighestQuality;
103108
showLatency = defaultShowLatency;
109+
useEnhancedRendering = defaultUseEnhancedRendering;
104110

105111
showOverlay = defaultShowOverlay;
106112
toggleableOverlay = defaultToggleableOverlay;

lib/screens/settings/stores/settings_store.g.dart

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/screens/settings/video_settings.dart

+10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ class VideoSettings extends StatelessWidget {
4040
value: settingsStore.showLatency,
4141
onChanged: (newValue) => settingsStore.showLatency = newValue,
4242
),
43+
if (Platform.isAndroid)
44+
SettingsListSwitch(
45+
title: 'Use enhanced rendering',
46+
subtitle: const Text(
47+
'Enables a newer WebView rendering method that improves performance. May cause random crashes on some devices.',
48+
),
49+
value: settingsStore.useEnhancedRendering,
50+
onChanged: (newValue) =>
51+
settingsStore.useEnhancedRendering = newValue,
52+
),
4353
const SectionHeader('Overlay'),
4454
SettingsListSwitch(
4555
title: 'Use custom video overlay',

0 commit comments

Comments
 (0)