fix video crashing app on some Android devices
Forces Hybrid Composition in the webview. By default the webview uses Texture Layer Hybrid Composition which was causing crashes on my Pixel 7 and likely other devices reported by users. https://pub.dev/packages/webview_flutter#platformview-implementation-on-android
This commit is contained in:
parent
07b939832c
commit
362977c360
1 changed files with 13 additions and 3 deletions
|
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:frosty/screens/channel/video/video_store.dart';
|
||||
import 'package:simple_pip_mode/simple_pip.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
import 'package:webview_flutter_android/webview_flutter_android.dart';
|
||||
|
||||
/// Creates a [WebView] widget that shows a channel's video stream.
|
||||
class Video extends StatefulWidget {
|
||||
|
|
@ -43,9 +44,18 @@ class _VideoState extends State<Video> with WidgetsBindingObserver {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WebViewWidget(
|
||||
controller: widget.videoStore.videoWebViewController,
|
||||
);
|
||||
if (WebViewPlatform.instance is AndroidWebViewPlatform) {
|
||||
return WebViewWidget.fromPlatformCreationParams(
|
||||
params: AndroidWebViewWidgetCreationParams(
|
||||
controller: widget.videoStore.videoWebViewController.platform,
|
||||
displayWithHybridComposition: true,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return WebViewWidget(
|
||||
controller: widget.videoStore.videoWebViewController,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue