|
@@ -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);
|
|
|
|