mirror of
https://github.com/Monibuca/plugin-hdl.git
synced 2025-10-05 16:56:55 +08:00
chore: fit engine update
This commit is contained in:
8
main.go
8
main.go
@@ -31,9 +31,9 @@ func (c *HDLConfig) OnEvent(event any) {
|
|||||||
for streamPath, url := range c.PullOnStart {
|
for streamPath, url := range c.PullOnStart {
|
||||||
pull(streamPath, url)
|
pull(streamPath, url)
|
||||||
}
|
}
|
||||||
case *Stream: //按需拉流
|
case InvitePublish: //按需拉流
|
||||||
if url, ok := c.PullOnSub[v.Path]; ok {
|
if url, ok := c.PullOnSub[v.Target]; ok {
|
||||||
pull(v.Path, url)
|
pull(v.Target, url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ func (c *HDLConfig) API_Pull(rw http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (*HDLConfig) API_List(rw http.ResponseWriter, r *http.Request) {
|
func (*HDLConfig) API_List(rw http.ResponseWriter, r *http.Request) {
|
||||||
util.ReturnJson(FilterStreams[*HDLPuller], time.Second, rw, r)
|
util.ReturnFetchValue(FilterStreams[*HDLPuller], rw, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保HDLConfig实现了PullPlugin接口
|
// 确保HDLConfig实现了PullPlugin接口
|
||||||
|
6
pull.go
6
pull.go
@@ -27,7 +27,11 @@ func NewHDLPuller() *HDLPuller {
|
|||||||
pool: make(util.BytesPool, 17),
|
pool: make(util.BytesPool, 17),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func (puller *HDLPuller) Disconnect() {
|
||||||
|
if puller.Closer != nil {
|
||||||
|
puller.Closer.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
func (puller *HDLPuller) Connect() (err error) {
|
func (puller *HDLPuller) Connect() (err error) {
|
||||||
HDLPlugin.Info("connect", zap.String("remoteURL", puller.RemoteURL))
|
HDLPlugin.Info("connect", zap.String("remoteURL", puller.RemoteURL))
|
||||||
if strings.HasPrefix(puller.RemoteURL, "http") {
|
if strings.HasPrefix(puller.RemoteURL, "http") {
|
||||||
|
Reference in New Issue
Block a user