|
@@ -5,6 +5,7 @@ import 'package:flutter/foundation.dart';
|
|
|
import 'package:logging/logging.dart';
|
|
|
|
|
|
DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
|
|
+bool disableMediaKit = false;
|
|
|
|
|
|
// https://gist.github.com/adamawolf/3048717
|
|
|
final Set<String> iOSLowEndMachineCodes = <String>{
|
|
@@ -30,6 +31,21 @@ final Set<String> iOSLowEndMachineCodes = <String>{
|
|
|
"iPhone10,5", // iPhone 8
|
|
|
};
|
|
|
|
|
|
+Future<void> initDeviceSpec() async {
|
|
|
+ if (Platform.isAndroid) {
|
|
|
+ // Note: The current version of media_kit crashes while playing video when
|
|
|
+// hardware malloc is enabled. Users either need to disable the hardware
|
|
|
+// malloc for our app or we need to disable the media_kit for these devices.
|
|
|
+// Currently, we have disabled the media_kit for these devices. and in the
|
|
|
+// future if needed we can add a setting.
|
|
|
+ final androidInfo = await deviceInfoPlugin.androidInfo;
|
|
|
+ disableMediaKit = androidInfo.toString().contains('graphene') ||
|
|
|
+ androidInfo.toString().contains('divest');
|
|
|
+ } else {
|
|
|
+ disableMediaKit = false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
Future<bool> isLowSpecDevice() async {
|
|
|
try {
|
|
|
if (Platform.isIOS) {
|
|
@@ -53,11 +69,5 @@ Future<bool> isAndroidSDKVersionLowerThan(int inputSDK) async {
|
|
|
}
|
|
|
|
|
|
bool isCompatibleWithMediaKit() {
|
|
|
- final os = Platform.operatingSystem.toLowerCase();
|
|
|
- if (os.contains("graphene") || os.contains("divest")) {
|
|
|
- Logger("device_info").info("os is $os, using video_player for videos");
|
|
|
- return false;
|
|
|
- }
|
|
|
- Logger("device_info").info("os is $os, using media_kit for videos");
|
|
|
- return true;
|
|
|
+ return disableMediaKit == false;
|
|
|
}
|