This commit is contained in:
seydx
2025-05-26 20:18:13 +02:00
parent a2d422f5cb
commit 9efc717633
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -64,14 +64,14 @@ func Dial(rawURL string) (core.Producer, error) {
// Stream params // Stream params
streamResolution := query.Get("resolution") streamResolution := query.Get("resolution")
useTuyaApi := deviceId != "" && email != "" && password != "" useSmartApi := deviceId != "" && email != "" && password != ""
useCloudApi := deviceId != "" && uid != "" && clientId != "" && clientSecret != "" useCloudApi := deviceId != "" && uid != "" && clientId != "" && clientSecret != ""
if streamResolution == "" || (streamResolution != "hd" && streamResolution != "sd") { if streamResolution == "" || (streamResolution != "hd" && streamResolution != "sd") {
streamResolution = "hd" streamResolution = "hd"
} }
if !useTuyaApi && !useCloudApi { if !useSmartApi && !useCloudApi {
return nil, errors.New("tuya: wrong query params") 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)), handlers: make(map[uint32]func(*rtp.Packet)),
} }
if useTuyaApi { if useSmartApi {
if client.api, err = NewTuyaSmartApiClient(nil, u.Hostname(), email, password, deviceId); err != nil { if client.api, err = NewTuyaSmartApiClient(nil, u.Hostname(), email, password, deviceId); err != nil {
return nil, fmt.Errorf("tuya: %w", err) return nil, fmt.Errorf("tuya: %w", err)
} }
+1 -1
View File
@@ -231,7 +231,7 @@ func (c *TuyaMqttClient) onMqttCandidate(msg *MqttMessage) {
return 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.TrimPrefix(candidateFrame.Candidate, "a=")
candidateFrame.Candidate = strings.TrimSuffix(candidateFrame.Candidate, "\r\n") candidateFrame.Candidate = strings.TrimSuffix(candidateFrame.Candidate, "\r\n")