- [x] 弹幕自动重连(30s)
- [x] 直播流开播自动下载
- [x] 直播流断流再保存
+- [x] 直播hls流均衡负载
- [x] 命令行支持房间切换、弹幕发送、启停录制
- [x] GTK信息窗支持房间切换、弹幕格式化发送、时长统计
- [x] GTK弹幕窗支持自定义人/事件消息停留
在`demo/config/config_K_v.json`中可找到配置项,0:随机可用端口 >0:固定可用端口 <0:禁用服务。
```
- "直播保存位置Web服务":0,
+ "直播Web服务口":0,
```
开启之后,启动会显示服务地址,在局域网内打开网址可以取得所有直播流的串流地址
flv_front []byte//flv头及首tag
flv_stream *msgq.Msgq//发送给客户的flv流关键帧间隔片
- m4s_hls int
+ hls_banlance_host bool//使用均衡hls服务器
wait *s.Signal
cancel *s.Signal
savestream.base_path = path+"/"
}
}
+ if v, ok := c.K_v.LoadV(`直播hls流均衡`).(bool);ok {
+ savestream.hls_banlance_host = v
+ }
}
//已go func形式调用,将会获取直播流
continue
}
+ //random host load balance
+ if savestream.hls_banlance_host {
+ Host_list := []string{}
+ for _,v := range c.Live {
+ url_struct,e := url.Parse(v)
+ if e != nil {continue}
+ Host_list = append(Host_list, url_struct.Hostname())
+ }
+ random := int(time.Now().Unix())
+ for i:=0;i<len(links);i+=1 {
+ url_struct,e := url.Parse(links[i].Url)
+ if e != nil {continue}
+ url_struct.Host = Host_list[(random+i) % len(Host_list)]
+ links[i].Url = url_struct.String()
+ }
+ }
+
//qn in expect , set expires
if c.Live_want_qn >= c.Live_qn {
expires = int64(exp)
"直播流类型-help": "flv or hls",
"直播流类型": "hls",
"直播流保存位置": "./live",
- "直播流缓冲": 20,
+ "直播hls流均衡-help":"true:使用所有hls服务器",
+ "直播hls流均衡": true,
"ass-help": "只有保存直播流时才考虑生成ass,ass编码默认GB18030(可选utf-8)",
"生成Ass弹幕": true,
"Ass编码": "GB18030",