Skip to content

HomeKit Secure Video 3 (iOS 27) - #1132

Draft
seydx wants to merge 6 commits into
homebridge:latestfrom
seydx:secure-video
Draft

seydx wants to merge 6 commits into
homebridge:latestfrom
seydx:secure-video

Conversation

@seydx

@seydx seydx commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

iOS 27 comes with a new set of camera services. Apple calls them "secure video", the hub logs call it HKSV3. This PR adds the definitions for them plus a SecureVideoController that bundles them behind typed delegates, in the same shape as CameraController.

The implementation follows Apple's HomeKit Secure Video Open Source Compatibility Guide for iOS 27, plus a fair amount of iOS and tvOS sysdiagnoses where the guide stops. I used Claude a lot for that part, digging through homed and avconferenced logs, comparing sessions, and turning what the hub actually does into code. The findings below all come from real traffic against a real hub, not from guessing.

What the new path looks like

A secure video accessory has one sensor description (CameraCapabilities), a global operating mode, motion zones, a multi-tier RTP stream management for local viewing, a WebRTC stream management for remote viewing, and the same HDS recording management the classic HKSV uses. Local viewing is plain SRTP like before, just negotiated through tiers instead of the old start/reconfigure dance. Remote viewing is WebRTC through Apple's relay, with SFrame end-to-end encryption on top of DTLS-SRTP. Recording still goes over HDS bulk send, the hub just analyses it differently.

Optional on top of that: CMAF accessory direct upload (buffer, key and client certificate management) where the camera uploads the clip itself instead of streaming it to the hub (see below).

With this path an HEVC camera runs natively end to end. The multi-tier RTP stream for local viewing is the camera's own HEVC, the WebRTC stream for remote viewing is the same HEVC packetized for the relay, and recording is the HEVC stream remuxed to fMP4.

Tested

  • Pairing, capabilities, operating modes, motion zones
  • Local live view over multi-tier RTP, native HEVC pass-through
  • Remote live view over WebRTC through Apple's relay, HEVC
  • Event recording over HDS, clips show up in Home
  • Snapshots for the camera tile
  • Two-way audio, local and remote

Note

  • H.264 does not work on the remote WebRTC path, and it's the viewer, not the negotiation. The Home app's media stack (avconferenced) builds the receiver for the camera stream from its own capability blob, and that blob is HEVC-only in every iOS 27 and tvOS 27 dump I looked at. An H.264 offer negotiates fine, the answer echoes the codec, but the receiver side then fails with VCVideoFeatureListStringHelper defaultPayload: featureListStrings is empty and No matched feature list string for payload: Apple's H.264 receive path expects a negotiated feature list string (FaceTime heritage), HEVC doesn't need one. Nothing in the SDP or fmtp on the accessory side changes that. So I route H.264 cameras to the classic CameraController, that path is H.264 only in the other direction.
  • Secure video services and a classic CameraRTPStreamManagement on the same accessory don't mix, Home shows "No Response". It's one path or the other per accessory.
  • fMP4 for recording needs the hvc1 sample entry, with hev1 the hub aborts after the third fragment. The hub also expects a prft box in front of each moof, otherwise homed crashes while reading the fragment date.
  • Remote talkback: the relay sends the viewer's microphone with SSRCs and payload types that never appear in any SDP, and the SFrame keys from WebRTCUpdateSession are per stream (HKDF with the SSRC as salt before the RFC 9605 derivation, same as the camera's own sender key).

Not working yet: CMAF direct upload

The provisioning half is verified against the hub: camera key, signed client certificate, publishing point token, buffer activity and upload commands all arrive as described. The upload itself doesn't. Every PUT to the publishing point (cloudkit-video-service) returns 400 with an empty body, before authentication kicks in (no client certificate, a self-signed one, other session ids, other bodies, other headers, all 400; other paths 404; GET 401). The hub never talks to that endpoint itself, it only creates the CloudKit clip record, so there's nothing to compare against without a trace of a real HKSV3 camera. The code stays in because the delegate is optional and off unless a consumer wires it, but I wanted to be upfront that this part is unverified. If maintainers would rather see it split out, I can do that.

How I test this

I develop and run this in camera.ui, which uses hap-nodejs directly. The HomeKit plugin there carries the WebRTC side (werift), the SFrame crypto, the RTP framing and the media pipeline, and picks the controller by codec: HEVC cameras get the secure video controller, H.264 cameras stay on the classic one.

How you can test

Install camera.ui (https://docs.cameraui.com/install/), add a camera with an HEVC main stream, install the HomeKit plugin from the in-app plugin store and enable HomeKit for that camera. The plugin shows a setup code, add it in Home, then it's the same flow as in the video: live view locally, live view remotely, talk. For recording the hub needs motion events, so the camera needs a motion source in camera.ui, either the built-in detection or a plugin that delivers the camera's own motion events (ONVIF for example). H.264 cameras stay on the classic HKSV path, so to see the new services you need HEVC, or the "Force legacy path" toggle in the camera settings to compare both on the same camera.

hksv3new_1.mp4

@Chrisalvir1

Copy link
Copy Markdown

Lo he probado y he podido exportar mis cámaras en HEVC, pero encuentro ciertos problemas por ejemplo el audio algunos si los da y muy mal con un sonido horrible y hay otras que no las da del todo, debería de tener el audio máximo de 24bits que pide apple con aac, y otra cosita que faltan integraciones como Google Nest, Ezviz, entre otros modelos, muestre la calidad real de la cámara si lo tengo en h264 u h265 antes de exportar y las entidades se puedan también exportar junto con la cámara a HomeKit ya sea que tenga luz, sirena entre otros que admita Apple con HAP.

@hjdhjd

hjdhjd commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution @seydx. I'm also in the middle of a comprehensive rework for HAP-NodeJS to support the new capabilities. Will be good to compare notes as it evolves.

Speaking for the Homebridge team...this is likely going to be a methodical process...we're not going to flip the switch here on the new camera capabilities. Just to set people's expectations. There's some forward-planning that's needed from an API perspective for both HAP-NodeJS and Homebridge and we're taking it a step at a time.

I write and maintain homebridge-unifi-protect and several other plugins. I've been working through this for a good portion of the summer and testing the capabilities out.

Appreciate of the work you've done and look forward to seeing where we're making different choices.

@Chrisalvir1

Copy link
Copy Markdown

H264 cameras that are 2k cannot take advantage of level 5 since it does not allow it yet only level 4 to 1080p, I have several cameras in H264 camera.ui and the audio does not work it makes a buzzing noise, there is no configuration to change the audio to AAC-ELD or Opus since not even the cameras in H264 and H265 with HKSV3, I get real audio and it is a problem some mute and others with buzz, I have the transmission in HomeKit without audio because they do not work in camera.ui

@hjdhjd
hjdhjd self-requested a review October 15, 2026 16:26
@seydx

seydx commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@hjdhjd

Just for your information, I'll be pushing my work on CMAF in the next few days. Apple’s current compatibility guide is very incomplete, and I’m in touch with them about it

Uploading via CMAF is currently working, and the clips are now visible in Apple Home via this path. However, they can’t be played yet. As soon as that works, I’ll push my work, and then the spec will be complete so you can compare for your rework

@hjdhjd

hjdhjd commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

@seydx Appreciate it...looking forward to seeing it and look forward to seeing where things can potentially come together. Across our two plugins, we've got a pretty good audience for this capability. I'm expecting to bring the pieces together over the next few weeks. I also expect that some of the bugs/quirks are going to get worked out for iOS 27.2 or thereabouts and will help amp this up a bit. You're a braver soul than I to show your WIP as we move along. 😄

@ZeliardM

Copy link
Copy Markdown

@seydx @hjdhjd Hey all! I wanted to let you know that I will be uploading to my personal forks for HAP-NodeJS, node-arlo, and homebridge-arlo hopefully later this afternoon/evening.

I have taken seydx's work which has been fantastic along with my own work and I have finally gotten a fully functioning HKSV3 model from end to end, Local MultiTieredRTP Streaming, Remote WebRTC Streaming, and CMAF Recording.

Two-Way Audio works on both streaming types, although there is an Apple Bug that I have reported that if you use the All Cameras Switcher in the Home App on a Remote WebRTC Streaming and switch between two cameras, you lose two-way audio capabilities until you close the stream and re-open it fresh. The talk button just isn't there until you re-open it.

Recordings work for uploading and playback, I had some work that I did for handling the playback in getting the keys and encryption handling correct but I got it and everything looks like it works for me.

I'll edit this post and like the repositories and their respective branches as well when I get everything up and confirmed on my end.

@seydx

seydx commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

@ZeliardM

I'm glad it helped you and that you solved the CMAF issue! I'll take a closer look at it once you're done :)

I'm still waiting here for the official response from Apple, since I haven't looked into that part about the keys and playback any further. As soon as the response comes in, I'll update this PR too, and you can compare your work to it :)

@hjdhjd

hjdhjd commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Looking forward to reviewing it as well @ZeliardM - my own work should be pulling most of this all together into something cohesive. I'm expecting a busy November and December to land it all.

# Conflicts:
#	src/lib/Accessory.spec.ts
#	src/lib/Accessory.ts
#	src/lib/Characteristic.ts
#	src/lib/Service.ts
#	src/lib/camera/RecordingManagement.ts
#	src/lib/camera/index.ts
#	src/lib/controller/index.ts
#	src/lib/definitions/CharacteristicDefinitions.spec.ts
#	src/lib/definitions/ServiceDefinitions.spec.ts
#	src/lib/definitions/ServiceDefinitions.ts
#	src/lib/definitions/generator-configuration.ts
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 41714830934

Coverage increased (+0.6%) to 78.896%

Details

  • Coverage increased (+0.6%) from the base build.
  • Patch coverage: 280 uncovered changes across 6 files (1262 of 1542 lines covered, 81.84%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
src/lib/controller/SecureVideoController.ts 462 341 73.81%
src/lib/camera/HDSSnapshotTransport.ts 87 10 11.49%
src/lib/camera/CMAFIngest.ts 254 223 87.8%
src/lib/camera/SecureVideoTypes.ts 292 268 91.78%
src/lib/camera/CMAFTracks.ts 250 227 90.8%
src/lib/camera/RecordingManagement.ts 4 0 0.0%
Total (11 files) 1542 1262 81.84%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/lib/camera/RecordingManagement.ts 1 52.12%

Coverage Stats

Coverage Status
Relevant Lines: 10159
Covered Lines: 7985
Line Coverage: 78.6%
Relevant Branches: 1531
Covered Branches: 1238
Branch Coverage: 80.86%
Branches in Coverage %: Yes
Coverage Strength: 465.59 hits per line

💛 - Coveralls

@erikpendragon

erikpendragon commented Nov 22, 2026 •

Copy link
Copy Markdown

Thanks for this branch. I used your CMAFIngest/CMAFTracks to get HKSV3 recordings uploading and playing in Apple Home (tvOS 27 hub). Notes from testing against Apple's ingest, in case they help the "visible but not playable" problem:

  • Encrypted segments (AES-GCM + session key): accepted, but the clip plays black.
  • Separate audio and video renditions, unencrypted: accepted, plays black.
  • Unencrypted, audio and video muxed into one rendition named "video": plays, with audio. Master playlist with the sensor-id session data, User-Agent on every request, x-extinf-duration header on each segment PUT.
  • Start each track's tfdt at 0, and leave out an audio track that has no samples.

Happy to share the uploader code if it helps.

@seydx

seydx commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

I'm still waiting for Apple's response... The last message I received from Apple was:

If you get far enough to get uploads working, feel to ping back here and we will see if we might be able to release some more info on the crypto implementation.

:)

@erikpendragon

Copy link
Copy Markdown

Update: encrypted uploads work now too. Clips play in Home with audio and video, show the right date, and Home's face recognition runs on them. So it may be worth pinging Apple back.

What made the encrypted path play, on top of the single muxed "video" rendition from my last comment:

  • Content key: HKDF-SHA256 of the hub's camera key, empty salt, info HomeKit 1.0 CMAF Content, 32 bytes. Key ID = (keyNumber << 16) | (1 << 14) as 16 hex digits.
  • The key URI must be hksv3:<key id>.key, in both #EXT-X-SESSION-KEY (master) and #EXT-X-KEY (media), with METHOD=AES-256-GCM. With a bare hex URI the player rejects the key, and that was my black video.
  • The init segment and each media segment are sealed whole: 16-byte IV, AES-256-GCM ciphertext, 16-byte tag.
  • Clip date: com.apple.encrypted-datetime.timestamp session data is base64 of JSON {method, iv, kid, ciphertext, tag}, sealing YYYY-MM-DDTHH:MM:SSZ. Without iv and kid the clip has no date.

Timing and pre-motion:

  • Each fragment gets a prft box with its wall-clock time.
  • The prebuffer arrives in a burst. I hold it until a fragment arrives at media pace, then place the clip on the wall clock.
  • The start in the hub's upload command can be 5 to 10 s later than the moment the command arrives. So I measure the hub's pre-roll from the earlier of the two. Otherwise the pre-motion part is trimmed away.

The code is on top of your secure-video branch: https://github.com/erikpendragon/HAP-NodeJS/tree/hksv3-muxed-upload
It adds CMAFMuxed.ts, a muxed path in CMAFIngest (off by default there, on by default in the controller) and a few controller options, with tests. I can open a PR into secure-video if you want it, or split it into smaller ones.

@hjdhjd

hjdhjd commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

@seydx - I appreciate the enthusiasm you've brought to this from the start...it's been good to see others digging into it in the open.

A quick update for everyone following along here...our work on this has landed. #1154 merged into beta-2.4.0 and is published as @homebridge/hap-nodejs@2.4.0-beta.2. It adds full support for iOS 27's modern camera and HomeKit Secure Video infrastructure - what Apple calls HKSV3 internally:

  • Live video in tiers for viewing at home.
  • Views from away over WebRTC, with the engine built into the library.
  • Recordings the camera uploads itself.

I've been working through the protocol for the past couple of months - testing against real hubs and building this out a piece at a time. Along the way I've folded a lot of the hard parts into HAP-NodeJS itself to make life simpler for camera plugin developers. The library now runs every viewing session at home and from away, keeps the recent video, and encrypts and uploads each recording. A plugin describes its camera, hands the library a video stream for each quality it offers, and reports motion. You should be able to get a camera up and running in a single evening.

Two guides came out of that work:

  • Plugin developers: Upgrading a Camera Plugin to HAP-NodeJS 2.4 - what changed in the library and how a camera takes on the new features. There's also a runnable example camera in src/accessories/ModernCamera_example.ts.
  • Protocol details: HomeKit Cameras in iOS 27 - the features themselves and how a home hub behaves around them. It's the write-up of what I learned along the way, and I hope it's useful to anyone working in this space.

If you'd like to see it running in a real plugin, homebridge-unifi-protect 8.5.0 is a working live example. On Homebridge 2.6.0-beta.1 or later, it streams and records each HEVC camera's own video natively, with no transcoding.

This is a beta...we'd welcome testing and feedback, especially from those of you who've been deep in this. Please open an issue for anything you find. Thanks to everyone here for the work and the notes along the way.

I'm going to leave this PR open for a few days before closing it, and again, thank you all for your contributions to the community and please enjoy the fruits of many sleepless nights of mine. 😄

@seydx

seydx commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor Author

@hjdhjd

Great news =)

Section 8 of your guide says nothing moves a clip's place in the timeline. In my tests one thing does: #EXT-X-SESSION-DATA with DATA-ID="com.apple.encrypted-datetime.timestamp" in the multivariant playlist.

Without it, Home dated my clips to about the upload command, roughly 10 seconds after the clip's first frame (camera OSD 20:46:55, Home 20:47:05). With it, start and end in Home match the camera's OSD to the second (OSD 21:29:39 to 21:29:55, Home 21:29:39 to 21:29:55), so the lead-up before the motion sits at the right time too.

The value is base64 of a JSON object that seals the clip's start under the clip's content key:

{"method":"AES-256-GCM","iv":"<base64>","ciphertext":"<base64>","tag":"<base64>","kid":"14000"}
  • The plaintext is the start as YYYY-MM-DDTHH:MM:SSZ, UTC, whole seconds. I take it from the prft of the first uploaded video segment.
  • It's sealed like a segment: AES-256-GCM, random 16-byte IV, no AAD, but with iv, ciphertext and tag as separate base64 fields.
  • kid is the key identifier in hex, without hksv3: and .key.

@erikpendragon saw the same earlier in this thread: without iv and kid the clip had no date. For clips without the entry the iPhone logs "Camera recording session session-N does not have a date, ensure that it was materialized". It might also help with the event that got dropped because its clip started more than 5 seconds off, but I haven't tested that.

One more thing on key IDs: the low 14 bits are a ratchet count. K(n+1) = HKDF-SHA256(K(n), empty salt, info "HomeKit 1.0 Ratchet", 32 bytes), and the content key is derived from K(n). A clip at count 1 (key ID ending in 4001) played for me. I don't know when a camera is supposed to advance it, so I stay at 0 like you do.

Have you tried the timestamp on your side?

@seydx

seydx commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

@hjdhjd

I pushed the encryption to secure-video in case you want to compare: seydx@9c24611

  • CMAFEncryption.ts derives the content key with the ratchet count and seals the segments and the timestamp.
  • CMAFIngest.ts writes EXT-X-SESSION-KEY, the sensor ID and the sealed timestamp into the multivariant playlist, and EXT-X-KEY into the media playlists.
  • The same commit adds #EXT-X-MEDIA-SEQUENCE:1001 to the media playlists, which was the cause of my 404s, and gives the audio playlist the same EXTINF durations as the video.

Unlike yours it seals the init segment too. Clips play either way.

PS: Enjoy the fruits of many sleepless nights of mine too :D

@hjdhjd

hjdhjd commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Great adds...will incorporate into the next beta @seydx 😄

Hope you enjoy the streamlined interface into HAP-NodeJS.

@ZeliardM

Copy link
Copy Markdown

@hjdhjd congratulations on #1154 landing, and thanks for the two guides. They make the new surface easy to follow.

Like @seydx, I'd been building the same camera surface on my own fork to get my Arlo cameras onto iOS 27. I've pushed it in case it's useful to compare: ZeliardM/HAP-NodeJS rebuild/modern-camera-2.3.0, one commit on v2.3.0. It isn't a merge proposal; I've stopped work on it now that yours is in the beta.

It divides the work differently from yours. A separate ModernCameraController sits beside the stock one. HAP-NodeJS owns the TLV8 codecs, the services, recording provisioning, the hub's upload commands and the CMAF uploads. The plugin supplies the media: its own RTP, its own WebRTC peer and the recording fragments. It has been running on my Homebridge with five HEVC cameras: views at home and from away, two-way audio, and uploads the hub accepts and Home plays.

The one thing I'd ask you to consider is recording on demand. Arlo cameras are cloud cameras, and some of them run on battery. Their video comes through Arlo's cloud, and only while something asks for it. Keeping a stream open around the clock isn't practical: it would drain the battery models and hold a cloud stream open for every camera. So my plugin never holds one. In my fork the camera's stream starts when motion is reported, or when the hub opens its recording stream, with no prebuffer, and Home accepts and plays those clips. As far as I can read 2.4.0-beta.2, the recorder holds the recorded tier whenever recording is allowed and the camera is in service (BufferRecorder), and a hub's recording open is served only from that buffer. Would it fit your design to have an option for cameras like these that raises the recorded tier on motion or on the hub's open instead, accepting that the clip has no pre-motion video?

A smaller one, from reading the code and not tested against a hub: the opening media playlist declares EXT-X-TARGETDURATION from the segments known when it's sent (CMAFRecordingManagement.ts). The closing playlist then recomputes it from every segment sent (clipPackaging.ts). A later, longer segment would raise the target within an EVENT playlist, which RFC 8216 only lets change by appended lines. My fork fixes the target at opening with a second of headroom.

And +1 to @seydx on com.apple.encrypted-datetime.timestamp; my fork sends it too.

@hjdhjd

hjdhjd commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

@ZeliardM thank you, and thanks for the kind words on the guides.

Recording on demand. You're reading the code correctly. Today the recorder keeps the recorded tier running whenever recording is allowed, because it serves the hub from the camera buffer with the lead-up already in hand. That's a good default for local cameras...I agree it's not a good approach for the cloud-based pull you're doing. It's coming shortly...it's on my list, but I wanted to hash out the first case and get it out there...yours will come very shortly and it's my intention to have it in there for 2.4.0. 😄

EXT-X-TARGETDURATION. Good catch, you're right. The opening and closing playlists each work the value out for themselves, and a longer segment later in the clip would change it. We'll state it once and reuse it.

com.apple.encrypted-datetime.timestamp. That one is built and in hub testing now, together with stamping a recording with the time its first picture was taken and sealing the initialization segment. It will come in the next beta release here shortly.

@ZeliardM

Copy link
Copy Markdown

Awesome! Yea, I can see that. And I appreciate all your work on this. This is huge and a great undertaking and I really can't wait to iron it all out with my new Arlo plugin.

Great, yeah, I'm still going through everything in your documents and notes along with all of my code and my notes to see if there's anything else we could help each other with as well.

I am going to start pulling this into my plugin to test and see how it's working. May leave recording off until the on-demand is ready though, lol

@ZeliardM

Copy link
Copy Markdown

@hjdhjd as promised, here's what else came out of going through the guide against my own notes. Some is from my cameras, some from reading Apple's iOS 27 binaries. Each rests on one test or one static read, so take them as leads.

A second sensor. Home ignoring it looks like an Apple feature flag. HomeKitDaemon builds a camera's sensor list only behind Home/SecondPartyCamera, and that flag is absent from the shipped Home.plist on the iOS 27.2 RC (24B6115), so it reads false and Home gets an empty sensor list. Only an Apple-signed configuration profile can turn it on; nothing an accessory sends changes it. A live two-imager camera on iOS 27.0.1 showed one view and no selector, as you saw.

Motion zones. Saving, editing and then clearing a zone in Home sent nothing to the accessory: no Camera Zones write and no zone Active write (iOS 27.0.1, tvOS 27).

"No Response" after a view from away. Users will see a camera's tile read No Response for about half a minute after closing a remote view. It's the phone: it takes a snapshot through the stream that's closing, that snapshot never completes, and every snapshot for the camera then waits out a 30-second timeout (HMErrorDomain 8). Nothing on the accessory side changes it. I've reported it to Apple as FB24990090.

Talkback from away. Two Apple-side issues users will hit, reported as FB24990010 and FB24990140:

  • Talk only works on the first camera of a remote view. Swipe to another camera in the full-screen viewer and that camera gets no microphone packets, and often no talk button. The phone's control connection to the relay sends no keep-alives and times out after 30 idle seconds. The relay then withdraws the viewer's microphone section with an inactive reoffer, and the next camera's join fails with "Network is down". Closing the view and opening the next camera fresh brings talk back. That inactive reoffer is the one in section 5: it isn't the talk button, the voice keeps arriving after it, and a camera shouldn't end talk on it.
  • No talk chirp from away. The phone passes its mute flag as the system-sounds permission, so with talk unmuted, system sounds stay off.

The configuration number on legacy cameras. 2.4 now hashes the modern capability and tier values into the configuration number, which is great. The legacy stream configuration values still aren't hashed, so a legacy camera whose advertised resolutions change isn't re-read by a paired controller until it's re-paired.

@hjdhjd

hjdhjd commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

@ZeliardM thanks for sharing, it mirrors my own appreciate your Apple outreach.

Target duration and the date line. Both are in 2.4.0-beta.3: one target duration stated for the whole clip and the sealed date line, which does place a clip at the time its video was taken. That PR also seals the initialization segment.

Recording on demand. I measured the wait. A hub gives a camera about 15 or so seconds after it opens a recording to deliver the first fragment, then closes the stream with a timeout. Only a media fragment counts. The initialization segment by itself doesn't. A fragment has to be whole before it can leave, which leaves a camera that starts cold about 10-11 seconds to its first picture with four-second fragments. A clip with no premotion video was kept and played like any other. It's all in the protocol guide now, and it gives the option real room to work with...stay tuned, you should be able to do what you want in short order, pending a couple of more tests on my end.

A second sensor. Same here: one view and no selector. I haven't confirmed the reason myself, and the guide will keep saying what I see rather than why.

Motion zones. I'd seen that too. Zones are an area I haven't dug into further and set aside as lower priority, which is why the guide lists them as untested.

"No Response" after a view from away, and talkback from away. Thanks for filing those. The missing chirp is the Home app's own, and nothing in HKSV3 or the library bears on it. I'll watch for the other two here. On the reoffer, agreed, and the library already behaves that way: a viewer's talk follows the viewer's key and the voice that arrives, not the reoffer.

The configuration number on legacy cameras. You're right. The legacy stream configuration values aren't part of the hash, and that predates 2.4. It's a reasonable point and I've noted it for an upcoming beta.

@seydx

seydx commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

@hjdhjd

I haven't tried 2.4 yet, I will in the next days.

Until Apple's docs are updated, here is what Apple's engineers told me in my feedback thread, quoted so you can point to it. Most of it is in your guide by now. These parts aren't, or read differently:

CMAF session number

The camera should start with a CMAF session id of 1 at pairing, and increment it for every new CMAF session it begins. The camera needs to store and persist this value as it must be unique for each recording that gets uploaded.

That's Apple's answer to your untested point on re-pairing: 1 at pairing. I haven't checked it on a hub.

A CMAF session can be at max 5 minutes long, and if a recording goes longer than that, you need to end the current session, finalize the playlist, and start a new session with session id+=1.

Your hub cut at 300 s by itself. Apple puts the cut on the camera, so a camera shouldn't count on the hub's Stop.

Key ratchet

The key set by the Resident on the key mgmt service goes though derivation and ratcheting on a timer basis, so you won't just be able to use it directly until the rest of the docs are released.

That's the low 14 bits of the key ID from my earlier comment. Count 0 and count 1 both play for me, but Apple expects the camera to advance it on a timer and hasn't said which.

Encryption and the clip date

The actual segment encryption in HLS is AES-256-GCM as defined in https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-22#section-4.4.4.4

Note that we think unencrypted content may still play through the Home App in customer or seed builds, but there might be issues with the timeline display as we end-to-end encrypt the time of recordings.

They also said Matter hasn't published the end-to-end encryption spec yet.

Specs it builds on

User-Agent

User-Agent: HKSV/3.0 <ADK_Version> (; ; <Firmware_Version>)

  • Without Apple's ADK, <ADK_Version> "should be a unique name of the software package using alpha numeric characters with dashes and underscores allowed. Example HomeHelper-1.0".
  • The vendor sub-fields "may contain a space, dash, underscore, but can't contain colons, semi-colons, or parenthesis". A model name with parentheses has to be cleaned first.
  • <Firmware_Version> "SHALL match the value exposed on the HAP characteristic for firmware version number."

The ingest doesn't check these today, as you found, but that's the rule.

Playlist and track names

Apple's sample multivariant playlist for a 2K camera in 16:9:

#EXTM3U
#EXT-X-VERSION:11
#EXT-X-INDEPENDENT-SEGMENTS

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aud",NAME="Camera Audio",DEFAULT=YES,CHANNELS="1",URI="audio1/index.m3u8"

#EXT-X-STREAM-INF:BANDWIDTH=1635844,AVERAGE-BANDWIDTH=1579092,RESOLUTION=2560x1440,CODECS="hvc1.1.4.L150.B01,Opus",AUDIO="aud"
high/index.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=957930,AVERAGE-BANDWIDTH=859530,RESOLUTION=1920x1080,CODECS="hvc1.1.4.L120.B01,Opus",AUDIO="aud"
mid/index.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=581956,AVERAGE-BANDWIDTH=509370,RESOLUTION=640x360,CODECS="hvc1.1.4.L93.B01,Opus",AUDIO="aud"
low/index.m3u8

Follow the track names as shown in the sample above. They need to be named high, mid and low for the video and audio1 for the audio track.

Your guide found other names accepted too, and your appendix has EXT-X-VERSION:7 where Apple's sample has 11.

Smaller ones

The iCloud CMAF service does not need to learn about a session before it will accept an upload.

make sure every media segment you upload has the prft box in the mp4 as the Matter and HKSV3 specs state. That value is the timestamp of the beginning of that fragment in wall clock time (sync your clock from NTP sources to make sure its accurate).

Returning the CMAF session id used in the Buffer Upload Command response is fine, its not really used at this time.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants