Parcourir la source

获取是否缓冲完成

melon.yin il y a 2 ans
Parent
commit
c101ecdd11
2 fichiers modifiés avec 15 ajouts et 1 suppressions
  1. 0 1
      lib/async_vid/vid_data.dart
  2. 15 0
      lib/data_channel/channel.dart

+ 0 - 1
lib/async_vid/vid_data.dart

@@ -105,7 +105,6 @@ abstract class AsyncVidImageDataBase {
     _reader.close();
   }
 
-  @protected
   T getReader<T extends AsyncVidDataReaderBase>() => _reader as T;
 
   ///Read header from http data.

+ 15 - 0
lib/data_channel/channel.dart

@@ -84,6 +84,21 @@ abstract class VidDataChannel {
     }
   }
 
+  ///获取缓冲量
+  int getBufferSize() {
+    return source!.getReader().downloadedSize;
+  }
+
+  /// 获取文件尺寸
+  int getFileSize() {
+    return source!.getReader().totalSize;
+  }
+
+  /// 是否缓冲完成
+  bool get isBufferedDone {
+    return getBufferSize() >= getFileSize();
+  }
+
   VidUsProbe get probe => source!.probe;
   int get imageCount => source!.imageCount;
   VidUsImageFormat get imageFormat => source!.imageFormat;