test.dart 569 B

123456789101112131415161718192021
  1. import 'channel.dart';
  2. class VidChannelTest {
  3. void run() async {
  4. final channel = VidDataChannel.create(
  5. "http://cdn-bj.fis.plus/0B344F48BA574ECD82B7FEDB8848421A.vid");
  6. channel.downloadProgressChanged.addListener((sender, e) {
  7. if (e.progress == 1) {
  8. print('downloadProgressChanged: ${e.progress}');
  9. }
  10. if (e.error != null) {
  11. print('occur error');
  12. }
  13. });
  14. final loaded = await channel.load();
  15. if (loaded) {
  16. final frame = await channel.getImage(0);
  17. print('Frame-${frame.index}');
  18. }
  19. }
  20. }