diff --git a/pkg/tuya/client.go b/pkg/tuya/client.go index 50fc80b4..fbf6c31b 100644 --- a/pkg/tuya/client.go +++ b/pkg/tuya/client.go @@ -64,14 +64,14 @@ func Dial(rawURL string) (core.Producer, error) { // Stream params streamResolution := query.Get("resolution") - useTuyaApi := deviceId != "" && email != "" && password != "" + useSmartApi := deviceId != "" && email != "" && password != "" useCloudApi := deviceId != "" && uid != "" && clientId != "" && clientSecret != "" if streamResolution == "" || (streamResolution != "hd" && streamResolution != "sd") { streamResolution = "hd" } - if !useTuyaApi && !useCloudApi { + if !useSmartApi && !useCloudApi { return nil, errors.New("tuya: wrong query params") } @@ -79,7 +79,7 @@ func Dial(rawURL string) (core.Producer, error) { handlers: make(map[uint32]func(*rtp.Packet)), } - if useTuyaApi { + if useSmartApi { if client.api, err = NewTuyaSmartApiClient(nil, u.Hostname(), email, password, deviceId); err != nil { return nil, fmt.Errorf("tuya: %w", err) } diff --git a/pkg/tuya/mqtt.go b/pkg/tuya/mqtt.go index deb90b9e..52f928a5 100644 --- a/pkg/tuya/mqtt.go +++ b/pkg/tuya/mqtt.go @@ -231,7 +231,7 @@ func (c *TuyaMqttClient) onMqttCandidate(msg *MqttMessage) { return } - // candidate from device start with "a=", end with "\r\n", which are not needed by Chrome webRTC + // fix candidates candidateFrame.Candidate = strings.TrimPrefix(candidateFrame.Candidate, "a=") candidateFrame.Candidate = strings.TrimSuffix(candidateFrame.Candidate, "\r\n")