diff --git a/pkg/onvif/helpers.go b/pkg/onvif/helpers.go index 251f4579..f240f2ec 100644 --- a/pkg/onvif/helpers.go +++ b/pkg/onvif/helpers.go @@ -12,7 +12,7 @@ import ( ) func FindTagValue(b []byte, tag string) string { - re := regexp.MustCompile(`(?s)[:<]` + tag + `>([^<]+)`) + re := regexp.MustCompile(`(?s)<(?:\w+:)?` + tag + `\b[^>]*>([^<]+)`) m := re.FindSubmatch(b) if len(m) != 2 { return "" diff --git a/pkg/onvif/onvif_test.go b/pkg/onvif/onvif_test.go index cd57d60b..e9ffab04 100644 --- a/pkg/onvif/onvif_test.go +++ b/pkg/onvif/onvif_test.go @@ -84,6 +84,34 @@ func TestGetStreamUri(t *testing.T) { `, url: "rtsp://192.168.5.53:8090/profile1=r", }, + { + name: "go2rtc 1.9.4", + xml: ` + + + + rtsp://192.168.1.123:8554/rtsp-dahua1 + + + +`, + url: "rtsp://192.168.1.123:8554/rtsp-dahua1", + }, + { + name: "go2rtc 1.9.8", + xml: ` + + + + + rtsp://192.168.1.123:8554/rtsp-dahua2 + + + + +`, + url: "rtsp://192.168.1.123:8554/rtsp-dahua2", + }, } for _, test := range tests {