Supereg/secure-video-specification

packet spec seems to have conflicting information

koush opened this issue · 6 comments

koush commented

I'm having some trouble to get HomeKit to accept the mock files that you have in your examples. I did notice there seemed to be conflicting information about the dataSend data event construction:

image

The spec indicates that "packets" is an array, but then following examples show it as a dictionary:

{
  "header": {
    "protocol": "dataSend",
    "event": "data"
  },
  "message": {
    "streamId": 1,
    "packets": {
      "metadata": {
        "dataType": "mediaInitialization",
        "dataSequenceNumber": 1,
        "isLastDataChunk": true,
        "dataChunkSequenceNumber": 1
      },
      "data": "contents of ./chunks/mediaInitialization.mp4"
    }
  } 
}

So I think it should be this according to your written spec:

{
  "header": {
    "protocol": "dataSend",
    "event": "data"
  },
  "message": {
    "streamId": 1,
    "packets": [
      {
        "metadata": {
          "dataType": "mediaInitialization",
          "dataSequenceNumber": 1,
          "isLastDataChunk": true,
          "dataChunkSequenceNumber": 1
        },
        "data": "contents of ./chunks/mediaInitialization.mp4"
      }
    ]
  } 
}
koush commented

Have confirmed that the examples are incorrect, because after correcting, everything works. HSV support in HAP-NodeJS!

Here is a full example of a communication that worked for me https://github.com/Supereg/secure-video-specification/tree/master/examples
Those are incorrect?

The "array of dictionaries" comes from the public spec.
The dataSend data event is not special to HKSV but a generalized way of sending data through the HK Data Stream.
It is e.g. also used for voice data transmission for the Siri functionality of HomeKit Apple TV Remotes. And there you would actually send an array of packets.

But good to know, that they force a plain dictionary for HKSV.

I'll edit the spec.

Okay, wait a sec, what is now expected from homed, an array of length 1 or a dictionary?

koush commented

Okay, wait a sec, what is now expected from homed, an array of length 1 or a dictionary?

Currently, my implementation is working with an array of packets length 1. I will double check with a dictionary and get back to you. Maybe a dictionary works too?

koush commented

I can confirm that a dictionary does not work, at least using HAP-NodeJS to encode the payload.

I believe the spec samples are incorrect here.