Forráskód Böngészése

Merge branch 'master' of http://git.ius.plus:88/Project-Wing/fis_lib_vid

gavin.chen 2 éve
szülő
commit
f3e634268e
2 módosított fájl, 16 hozzáadás és 1 törlés
  1. 1 0
      lib/data_host/web/data_host.dart
  2. 15 1
      lib/data_host/web/shell.dart

+ 1 - 0
lib/data_host/web/data_host.dart

@@ -1,4 +1,5 @@
 import 'dart:convert';
+import 'package:fis_common/logger/logger.dart';
 import 'package:fis_vid/data_host/interface/data_host.dart';
 import 'package:fis_vid/common/vid_download.dart';
 import 'package:fis_vid/common/env.dart';

+ 15 - 1
lib/data_host/web/shell.dart

@@ -21,7 +21,8 @@ class _VidDataHostShell implements VidDataHostInterface {
 
   @override
   Future<VidDataHostLoadInfo?> load() async {
-    final rst = await _platform.getVidFile(url);
+    final rst = await getVidFile(url);
+
     if (rst == null || rst.isEmpty) return null;
 
     final buffer = const Base64Decoder().convert(rst);
@@ -31,6 +32,19 @@ class _VidDataHostShell implements VidDataHostInterface {
     return info;
   }
 
+  ///获取vid文件
+  Future<String?> getVidFile(String url, {int times = 0}) async {
+    try {
+      return await _platform.getVidFile(url);
+    } catch (e) {
+      logger.e('_VidDataHostShell load $times ex:', e);
+      if (times < 2) {
+        return await getVidFile(url, times: times++);
+      }
+      return null;
+    }
+  }
+
   @override
   Future<VidUsImage?> getFrame(int index) async => _data?.getImage(index);