Open Brunz opened 4 years ago
That's a good question actually. It seems we don't have the proper accessories / services / characteristics to do that. Those types are generated from a framework, but on my machine (latest Catalina), those types aren't present or we're not looking in the right place.
Actually there are some in the framework, but I couldn't understand why they are not imported by hap-update. I created them manually, I see the video window on homekit, but I have problems starting the video. Maybe I don't correctly insert the bytes (tlv8). Sorry for my English.
This is an example of what is found in "plain-metadata.config" and which is not imported:
`
We only emit the characteristics that are actually in use by a service. You can remove && whitelistedCharacteristics.contains(name)
on this line, so at least you get all the characteristics:
However you still wouldn't have a pre-made accessory and service, as those are not listed in that framework. Can you share what your configuration looks like so far, to get them listed in the Home app?
Great Bouke! "camera-rtp-stream-management" is a Service and YES this is in the "BlacklistFromApplications". I make a change to the inspector and try to import again.
The test implementation is attached to the message. Camera.swift.zip
ok, I have removed camera-rtp-stream-management from blacklistAppServices
if var index = blacklistAppServices.firstIndex(where: {$0 == "camera-rtp-stream-management"}){ blacklistAppServices.remove(at: index) }
..and now I have Service and Characteristics into Generated.swift
After I modified the file "CharacteristicValueType" in this way:
extension Data: CharacteristicValueType, JSONValueTypeConvertible { public init?(value: Any) { //fatalError("How does deserialization of Data work?") if let v = value as? String, let vd = Data(base64Encoded: v){ self = vd } return nil } static public let format = CharacteristicFormat.data public var jsonValueType: JSONValueType { //fatalError("How does serialization of Data work?") return self.base64EncodedString() } }
and now I'm at the point of before :) But it's much cleaner
Out of curiosity; what does your code look like now to initialize the camera accessory?
this: acc.append(Accessory.RTPCamera(info: Service.Info(name: "Camera", serialNumber: "00012"))) Append the accessory "RTPCamera" in Device.accessories array
And intercept "resource" in router func, for send camera snapshot to controller: func router(_ routes: [Route]) -> Responder { return { connection, request in if(request.url.path == "/resource"){ ...
The preview is ok now, the streaming rtsp still no.
But maybe I make some mistakes, because the controller should send me a response to the configuration of the Camera, but I don't see. If you want I can send the project, but it is compiled only on iOS.
@Brunz Did you ever get this to work?
Hi @joshsnelling ,
I implemented all the missing piece of protocol but I was unable to send the video in the correct format. I have also tried using ffmpeg for iOS to configure RTS streaming, but there are too many properties to configure and I am not an expert.
@Brunz Hi! Any progress with camera accessory implementation?
Could you create an IPCamera type accessory? I didn't understand how to do it