mirror of
https://github.com/Monibuca/plugin-rtsp2.git
synced 2025-10-19 13:54:35 +08:00
chore: first commit
This commit is contained in:
27
main.go
Normal file
27
main.go
Normal 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))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user