diff --git a/README.md b/README.md index fc2396e..282bbc0 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ go wvp 是 Go 语言实现的开源 GB28181 解决方案,基于 GB28181-2022 -|![](./docs/phone/login.webp)|![](./docs/phone/desktop.webp)|![](./docs/phone/gb28181.webp)| -|-|-|-| +|![](./docs/phone/login.webp)|![](./docs/phone/desktop.webp)|![](./docs/phone/gb28181.webp)|![](./docs/phone/discover.webp)| +|-|-|-|-| @@ -256,6 +256,8 @@ services: - [x] 音频支持 g711a/g711u/aac - [x] 快照 - [x] 支持跨域 + - [x] 支持中文和 English + - [x] 支持 onvif - [ ] 设备云台控制 - [ ] 录像回放 - [ ] 报警事件订阅 diff --git a/docs/phone/discover.webp b/docs/phone/discover.webp new file mode 100644 index 0000000..7197521 Binary files /dev/null and b/docs/phone/discover.webp differ diff --git a/internal/adapter/onvifadapter/hook.go b/internal/adapter/onvifadapter/hook.go index 15a67de..65d0167 100644 --- a/internal/adapter/onvifadapter/hook.go +++ b/internal/adapter/onvifadapter/hook.go @@ -16,7 +16,7 @@ func (a *Adapter) OnStreamChanged(ctx context.Context, stream string) error { if err := a.adapter.Store().Channel().Get(ctx, &ch, orm.Where("id=?", stream)); err != nil { return err } - if err := a.adapter.EditPlaying(ctx, ch.DeviceID, ch.ChannelID, false); err != nil { + if err := a.adapter.EditPlayingByID(ctx, ch.ID, false); err != nil { slog.ErrorContext(ctx, "编辑播放状态失败", "err", err) } return nil diff --git a/internal/core/ipc/protocol.go b/internal/core/ipc/protocol.go index 2700a34..1a9d6b3 100644 --- a/internal/core/ipc/protocol.go +++ b/internal/core/ipc/protocol.go @@ -81,6 +81,16 @@ func (g Adapter) Edit(deviceID string, changeFn func(*Device)) error { return nil } +func (g Adapter) EditPlayingByID(ctx context.Context, id string, playing bool) error { + var ch Channel + if err := g.store.Channel().Edit(ctx, &ch, func(c *Channel) { + c.IsPlaying = playing + }, orm.Where("id=?", id)); err != nil { + return err + } + return nil +} + func (g Adapter) EditPlaying(ctx context.Context, deviceID, channelID string, playing bool) error { var ch Channel if err := g.store.Channel().Edit(ctx, &ch, func(c *Channel) {