Add support tapo source

This commit is contained in:
Alexey Khit
2023-02-13 15:46:41 +03:00
parent 830baafffe
commit 665545903c
7 changed files with 356 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
package tapo
import (
"github.com/AlexxIT/go2rtc/cmd/streams"
"github.com/AlexxIT/go2rtc/pkg/streamer"
"github.com/AlexxIT/go2rtc/pkg/tapo"
)
func Init() {
streams.HandleFunc("tapo", handle)
}
func handle(url string) (streamer.Producer, error) {
conn := tapo.NewClient(url)
if err := conn.Dial(); err != nil {
return nil, err
}
if err := conn.Play(); err != nil {
return nil, err
}
if err := conn.Handle(); err != nil {
return nil, err
}
return conn, nil
}