support lalmax-pro keepalive

This commit is contained in:
xugo
2025-12-08 18:48:49 +08:00
parent 348c0f7464
commit 20fb7dc979
5 changed files with 15 additions and 6 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ go wvp 是 Go 语言实现的开源 GB28181 解决方案,基于 GB28181-2022
+ @夏楚 [ZLMediaKit](https://github.com/ZLMediaKit/ZLMediaKit)
+ **lalmax-pro 有 golang 流媒体的需求请联系微信 [golangxx](https://github.com/ixugo)**
+ **lalmax-pro 有 golang 流媒体的需求请联系微信 [joestar2006](https://github.com/joestarzxh)**
- 对环境没有要求,不需要安装任何静态库,支持跨平台编译
- 支持特色功能定制
- 支持 G711(G711A/G711U) 转 AAC
+3 -1
View File
@@ -142,7 +142,9 @@ func (l *LalmaxDriver) Setup(ctx context.Context, ms *MediaServer, webhookURL st
maxPort, _ = strconv.Atoi(ports[1])
}
if err := engine.SetHttpNotifyConfig(ctx, lalmax.HttpNotifyConfig{
Enable: true,
Enable: true,
KeepaliveIntervalSec: ms.HookAliveInterval,
OnKeepalive: fmt.Sprintf("%s/on_server_keepalive", webhookURL),
// OnPubStart: webhookURL,
// OnPubStop: webhookURL,
OnSubStartWithoutStream: fmt.Sprintf("%s/on_stream_not_found", webhookURL),
+1 -1
View File
@@ -104,7 +104,7 @@ func (d *ZLMDriver) Setup(ctx context.Context, ms *MediaServer, webhookURL strin
HookOnShellLogin: zlm.NewString(""),
HookOnStreamChanged: zlm.NewString(fmt.Sprintf("%s/on_stream_changed", webhookURL)),
HookOnServerKeepalive: zlm.NewString(fmt.Sprintf("%s/on_server_keepalive", webhookURL)),
HookTimeoutSec: zlm.NewString("20"),
HookTimeoutSec: zlm.NewString("10"),
HookAliveInterval: zlm.NewString(fmt.Sprint(ms.HookAliveInterval)),
ProtocolContinuePushMs: zlm.NewString("3000"),
RtpProxyPortRange: &ms.RTPPortRange,
+2 -1
View File
@@ -54,7 +54,8 @@ func registerZLMWebhookAPI(r gin.IRouter, api WebHookAPI, handler ...gin.Handler
// onServerKeepalive 服务器定时上报时间,上报间隔可配置,默认 10s 上报一次
// https://docs.zlmediakit.com/zh/guide/media_server/web_hook_api.html#_16%E3%80%81on-server-keepalive
func (w WebHookAPI) onServerKeepalive(_ *gin.Context, in *onServerKeepaliveInput) (DefaultOutput, error) {
w.smsCore.Keepalive(in.MediaServerID)
// TODO: 仅支持默认
w.smsCore.Keepalive(sms.DefaultMediaServerID)
return newDefaultOutputOK(), nil
}
+8 -2
View File
@@ -263,6 +263,8 @@ type HttpApiConfig struct {
type HttpNotifyConfig struct {
Enable bool `json:"enable"`
KeepaliveIntervalSec int `json:"keepalive_interval_sec"`
OnKeepalive string `json:"on_keepalive"`
UpdateIntervalSec int `json:"update_interval_sec"`
OnServerStart string `json:"on_server_start"`
OnUpdate string `json:"on_update"`
@@ -408,9 +410,13 @@ func (e *Engine) SetHttpNotifyConfig(ctx context.Context, config HttpNotifyConfi
// 使用合并模式,只更新 http_notify 配置
data := map[string]any{
"http_notify": config,
"rtsp": map[string]any{
"pub_not_sub_auto_close_sec": 30,
},
"gb28181": map[string]any{
"enable": false,
"media_config": gb28181,
"enable": false,
"pub_not_sub_auto_close_sec": 30,
"media_config": gb28181,
},
}
return e.setServerConfig(ctx, data, true)