chore: first commit

This commit is contained in:
langhuihui
2023-10-05 20:33:56 +08:00
parent a7c6147288
commit f8dc132bb5
4 changed files with 376 additions and 0 deletions

27
main.go Normal file
View File

@@ -0,0 +1,27 @@
package rtsp2
import (
"go.uber.org/zap"
"m7s.live/engine/v4"
"m7s.live/engine/v4/config"
)
type RTSP2Config struct {
config.Publish
config.Pull
}
var conf RTSP2Config
var RTSP2Plugin = engine.InstallPlugin(&conf)
func (*RTSP2Config) OnEvent(event any) {
switch v := event.(type) {
case engine.InvitePublish: //按需拉流
if url, ok := conf.PullOnSub[v.Target]; ok {
if err := RTSP2Plugin.Pull(v.Target, url, new(RTSPPuller), 0); err != nil {
RTSP2Plugin.Error("pull", zap.String("streamPath", v.Target), zap.String("url", url), zap.Error(err))
}
}
}
}