Explorar o código

获取是否缓冲完成

melon.yin %!s(int64=2) %!d(string=hai) anos
pai
achega
c101ecdd11
Modificáronse 2 ficheiros con 15 adicións e 1 borrados
  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;