The HKSV recording was failing because:
1. The dataSend.data message structure was wrong - `packets` was a flat integer
instead of an array of objects with `data` and `metadata` fields matching
the HAP-NodeJS specification
2. Each video/audio frame was sent as a separate mediaFragment, but Home Hub
expects GOP-based fragments (~2-4 seconds of accumulated data)
3. Large fragments were not chunked (max 256 KiB per chunk)
Changes:
- Fix HDS dataSend.data message structure to use proper packets array with
nested data/metadata (dataType, dataSequenceNumber, dataChunkSequenceNumber,
isLastDataChunk, dataTotalSize)
- Add 256 KiB chunking for large media fragments
- Buffer moof+mdat pairs in hksvConsumer and flush on keyframe boundaries
(GOP-based fragmentation)
- Pre-start consumer at pair-verify for instant init segment delivery
- Add write-response support to HAP PUT handler for ch131 DataStream setup
- Fix HAP service linking to match HAP-NodeJS reference
- Add default SelectedCameraRecordingConfiguration (ch209) value
- Start continuous motion generator at pair-verify with dedup protection
- Introduced HKSV configuration options in homekit.go, allowing for motion detection and doorbell features.
- Implemented API endpoints for triggering motion detection and doorbell events.
- Enhanced server.go to handle HKSV sessions and manage motion detection states.
- Created new accessory types for HKSV and doorbell in accessory.go.
- Added support for audio recording configurations in ch207.go.
- Defined new services for motion detection and doorbell in services_hksv.go.
- Implemented opack encoding/decoding for HDS protocol in opack.go and protocol.go.
- Updated OpenAPI documentation to reflect new endpoints and features.
- Extended schema.json to include HKSV configuration options.
Introduces VitePress configuration and theme files for documentation, updates the GitHub Pages workflow to build and deploy the new docs, and updates .gitignore for VitePress and Node artifacts. Adds necessary dependencies and scripts to package.json, and updates the ONVIF client example README title.
* feat(mjpeg): add keyframe caching with expiration and cleanup goroutine
* mjpeg: make keyframe cache duration and default usage configurable
* mjpeg: document and add config options for MJPEG snapshot caching
* mjpeg: fix errors after rebase
* Code refactoring for frame.jpeg cache #1155
---------
Co-authored-by: Alex X <alexey.khit@gmail.com>
* add tplink multitrans support
* 已经能成功播放音频了
* 初步能通讯了
* finish
* add tplink multitrans support
* 已经能成功播放音频了
* 初步能通讯了
* cleanup
* clean up
* Code refactoring for #1995
---------
Co-authored-by: Your Name <you@example.com>
Co-authored-by: Alex X <alexey.khit@gmail.com>