P2pConfig constructor

P2pConfig({
  1. P2pLogLevel logLevel = P2pLogLevel.warn,
  2. Map<String, dynamic> webRTCConfig = const {},
  3. String? wsSignalerAddr,
  4. String? announce,
  5. int diskCacheLimit = 1024 * 1024 * 1024,
  6. int memoryCacheLimit = 100 * 1024 * 1024,
  7. int memoryCacheCountLimit = 30,
  8. bool p2pEnabled = true,
  9. Duration downloadTimeout = const Duration(seconds: 30),
  10. Duration dcDownloadTimeout = const Duration(seconds: 6),
  11. String? tag,
  12. int localPort = 0,
  13. int maxPeerConnections = 20,
  14. bool useHttpRange = true,
  15. bool wifiOnly = false,
  16. Map<String, String>? httpHeaders,
  17. bool isSetTopBox = false,
  18. int httpLoadTime = 2000,
  19. bool logPersistent = false,
  20. bool sharePlaylist = false,
  21. bool waitForPeerInAndroid = false,
  22. int waitForPeerTimeoutInAndroid = 4500,
  23. List<String> hlsMediaFiles = const ["ts", "mp4", "m4s"],
  24. String? logFilePathInIos,
  25. AnnounceLocation? announceLocation,
  26. List<String>? hlsMediaFileExtensions,
})

Implementation

P2pConfig({
  this.logLevel: P2pLogLevel.warn,
  this.webRTCConfig: const {}, // TODO: 默认值缺少
  this.wsSignalerAddr, //: 'wss://signal.cdnbye.com',
  this.announce, //: 'https://tracker.cdnbye.com/v1',
  this.diskCacheLimit: 1024 * 1024 * 1024,
  this.memoryCacheLimit: 100 * 1024 * 1024,
  this.memoryCacheCountLimit: 30,
  this.p2pEnabled: true,
  this.downloadTimeout: const Duration(seconds: 30),
  this.dcDownloadTimeout: const Duration(seconds: 6),
  this.tag,
  this.localPort: 0,
  this.maxPeerConnections: 20,
  this.useHttpRange: true,
  this.wifiOnly: false,
  this.httpHeaders,
  this.isSetTopBox: false,
  this.httpLoadTime: 2000,
  this.logPersistent: false,
  this.sharePlaylist: false,
  this.waitForPeerInAndroid: false,
  this.waitForPeerTimeoutInAndroid: 4500,
  this.hlsMediaFiles: const ["ts", "mp4", "m4s"],
  this.logFilePathInIos,
  // 新
  this.announceLocation,
  this.hlsMediaFileExtensions,
});