Refactoring for HomeKit client
This commit is contained in:
@@ -3,6 +3,7 @@ package homekit
|
||||
import (
|
||||
"github.com/AlexxIT/go2rtc/cmd/api"
|
||||
"github.com/AlexxIT/go2rtc/cmd/app"
|
||||
"github.com/AlexxIT/go2rtc/cmd/srtp"
|
||||
"github.com/AlexxIT/go2rtc/cmd/streams"
|
||||
"github.com/AlexxIT/go2rtc/pkg/homekit"
|
||||
"github.com/AlexxIT/go2rtc/pkg/streamer"
|
||||
@@ -20,14 +21,12 @@ func Init() {
|
||||
var log zerolog.Logger
|
||||
|
||||
func streamHandler(url string) (streamer.Producer, error) {
|
||||
conn, err := homekit.Dial(url)
|
||||
conn, err := homekit.NewClient(url, srtp.Server)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
exit := make(chan error)
|
||||
go func() {
|
||||
//start goroutine for reading responses from camera
|
||||
exit <- conn.Handle()
|
||||
}()
|
||||
return &Client{conn: conn, exit: exit}, nil
|
||||
if err = conn.Dial();err!=nil{
|
||||
return nil, err
|
||||
}
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user