P2pConfig class
The configuration of p2p engine.
Constructors
-
P2pConfig({P2pLogLevel logLevel = P2pLogLevel.warn, Map<
String, dynamic> webRTCConfig = const {}, String? wsSignalerAddr, String? announce, int diskCacheLimit = 1024 * 1024 * 1024, int memoryCacheLimit = 100 * 1024 * 1024, int memoryCacheCountLimit = 30, bool p2pEnabled = true, Duration downloadTimeout = const Duration(seconds: 30), Duration dcDownloadTimeout = const Duration(seconds: 6), String? tag, int localPort = 0, int maxPeerConnections = 20, bool useHttpRange = true, bool wifiOnly = false, Map<String, String> ? httpHeaders, bool isSetTopBox = false, int httpLoadTime = 2000, bool logPersistent = false, bool waitForPeerInAndroid = false, int waitForPeerTimeoutInAndroid = 4500, List<String> hlsMediaFiles = const ["ts", "mp4", "m4s"], String? logFilePathInIos, AnnounceLocation? announceLocation, List<String> ? hlsMediaFileExtensions}) - P2pConfig.byDefault()
Properties
- announce → String?
-
tracker服务器地址
final
- announceLocation → AnnounceLocation?
-
tracker服务器地址所在国家
final
- dcDownloadTimeout → Duration
-
datachannel下载二进制数据的最大超时时间
final
- diskCacheLimit → int
-
点播模式下P2P在磁盘缓存的最大数据量(设为0可以禁用磁盘缓存)
final
- downloadTimeout → Duration
-
HTTP下载ts文件超时时间
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
hlsMediaFileExtensions
→ List<
String> ? -
自定义扩展支持的HLS媒体文件
final
-
hlsMediaFiles
→ List<
String> -
扩展支持的HLS媒体文件
final
-
httpHeaders
→ Map<
String, String> ? -
设置请求ts和m3u8时的HTTP请求头
final
- httpLoadTime → int
-
P2P下载超时后留给HTTP下载的时间(ms)
final
- isSetTopBox → bool
-
如果使用自定义的channelId,则此字段必须设置,且长度必须在5到15个字符之间,建议设置成你所在组织的唯一标识
如果运行于机顶盒请设置成true
final
- localPort → int
-
本地代理服务器的端口号
final
- logFilePathInIos → String?
-
iOS特有
日志文件的存储路径,默认路径是 Library/Caches/Logs/
final
- logLevel → P2pLogLevel
-
打印日志的级别
final
- logPersistent → bool
-
是否将日志持久化到外部存储
final
- maxPeerConnections → int
-
最大连接节点数量
final
- memoryCacheCountLimit → int
-
P2P在内存缓存的最大数据量,用ts文件个数表示,仅安卓有效
final
- memoryCacheLimit → int
-
final
- p2pEnabled → bool
-
开启或关闭p2p engine
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
是否允许m3u8文件的P2P传输
final
- tag → String?
-
用户自定义的标签,可以在控制台查看分布图
final
-
toMap
→ Map<
String, dynamic> -
no setter
- useHttpRange → bool
-
在可能的情况下使用Http Range请求来补足p2p下载超时的剩余部分数据
final
- waitForPeerInAndroid → bool
-
Android特有
优先尝试从对等端下载前几片数据,可以提高P2P比例,但可能会增加起播延时
final
- waitForPeerTimeoutInAndroid → int
-
Android特有
waitForPeer的超时时间,超时后恢复从http下载(ms)
final
-
webRTCConfig
→ Map<
String, dynamic> -
通过webRTCConfig来修改WebRTC默认配置
final
- wifiOnly → bool
-
是否只在wifi和有线网络模式上传数据(建议在云端设置)
final
- wsSignalerAddr → String?
-
信令服务器地址
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited