{"record":{"id":"712cfdbf42ceac6c","repo":"AlexxIT/go2rtc","slug":"homekit-can-t-work-without-srtp-server","errorCode":null,"errorMessage":"homekit: can't work without SRTP server","messagePattern":"homekit: can't work without SRTP server","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/homekit/homekit.go","lineNumber":133,"sourceCode":"\t}\n\n\tapi.HandleFunc(hap.PathPairSetup, hapHandler)\n\tapi.HandleFunc(hap.PathPairVerify, hapHandler)\n\n\tgo func() {\n\t\tif err := mdns.Serve(mdns.ServiceHAP, entries); err != nil {\n\t\t\tlog.Error().Err(err).Caller().Send()\n\t\t}\n\t}()\n}\n\nvar log zerolog.Logger\nvar hosts map[string]*server\nvar servers map[string]*server\n\nfunc streamHandler(rawURL string) (core.Producer, error) {\n\tif srtp.Server == nil {\n\t\treturn nil, errors.New(\"homekit: can't work without SRTP server\")\n\t}\n\n\trawURL, rawQuery, _ := strings.Cut(rawURL, \"#\")\n\tclient, err := homekit.Dial(rawURL, srtp.Server)\n\tif client != nil && rawQuery != \"\" {\n\t\tquery := streams.ParseQuery(rawQuery)\n\t\tclient.MaxWidth = core.Atoi(query.Get(\"maxwidth\"))\n\t\tclient.MaxHeight = core.Atoi(query.Get(\"maxheight\"))\n\t\tclient.Bitrate = parseBitrate(query.Get(\"bitrate\"))\n\t}\n\n\treturn client, err\n}\n\nfunc resolve(host string) *server {\n\tif len(hosts) == 1 {\n\t\tfor _, srv := range hosts {\n\t\t\treturn srv","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/internal/homekit/homekit.go#L115-L151","documentation":"The HomeKit module's streamHandler refuses to start a HomeKit producer when the global SRTP (Secure RTP) server has not been initialized. HomeKit streaming requires encrypted transport, so the library dials the camera through the shared srtp.Server; without it the operation is impossible and this error is thrown at internal/homekit/homekit.go:133.","triggerScenarios":"Requesting a stream from a homekit:// source (via streams play/API) while the SRTP server is nil — i.e. go2rtc was not started with SRTP enabled (missing listen address config for SRTP, or the module failed to start).","commonSituations":"Running go2rtc without the srtp module configured in the YAML config, the SRTP port being occupied so the server never initialized, or embedding the homekit module in a custom binary without calling SRTP initialization.","solutions":["Enable the SRTP server in the go2rtc config (configure the srtp listen address/port under the srtp section)","Check startup logs to confirm the SRTP server initialized before using homekit sources","Free the SRTP port if initialization failed due to address-in-use","When embedding go2rtc, initialize srtp.Server before handling homekit streams"],"exampleFix":"// before (go2rtc.yaml)\n# srtp section missing\n// after (go2rtc.yaml)\nsrtp:\n  listen: :8443","handlingStrategy":"validation","validationCode":"// Go: ensure SRTP server is initialized before using homekit sources\nif srtp.Server == nil {\n    return errors.New(\"enable srtp module in go2rtc.yaml before homekit streaming\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure the srtp section in go2rtc.yaml when using homekit sources","Check startup logs for SRTP initialization success","Verify the SRTP port is free before starting go2rtc"],"tags":["homekit","srtp","missing-dependency","config"],"backgroundTag":"missing-required-config","analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}