thibauts/node-castv2-client

Tab Mirroring over CASTV2

Open

#14 aberto em 1 de nov. de 2014

Ver no GitHub
 (14 comments) (0 reactions) (0 assignees)JavaScript (92 forks)github user discovery
help wanted

Métricas do repositório

Stars
 (656 stars)
Métricas de merge de PR
 (Métricas PR pendentes)

Description

The app used by Chrome is "Chrome Mirroring", and has application ID 0F5096E8.

The app is launched as usual and advertises protocols urn:x-cast:com.google.cast.webrtc and urn:x-cast:com.google.cast.media.

Once the app is launched, Chrome issues a CONNECT message to the transportId with two additional fields :

  • origin which value is {}
  • userAgent which contains the browser UA string

Then an OFFER is sent over the urn:x-cast:com.google.cast.webrtc channel :

{
  "type": "OFFER",
  "seqNum": 22790009,
  "offer": {
    "supportedStreams": [
      {
        "index": 0,
        "type": "audio_source",
        "codecName": "opus",
        "rtpProfile": "cast",
        "rtpPayloadType": 127,
        "ssrc": 306348,
        "storeTime": 400,
        "targetDelay": 400,
        "aesKey": "e91d41098c89ffb1352e8f65aa760bd4",
        "aesIvMask": "cabed613fdaf330a5576cc9ba0373e77",
        "bitRate": 128000,
        "sampleRate": 48000,
        "timeBase": "1\/48000",
        "channels": 2,
        "receiverRtcpEventLog": true
      },
      {
        "index": 1,
        "type": "video_source",
        "codecName": "vp8",
        "rtpProfile": "cast",
        "rtpPayloadType": 96,
        "ssrc": 866107,
        "storeTime": 400,
        "targetDelay": 400,
        "aesKey": "e91d41098c89ffb1352e8f65aa760bd4",
        "aesIvMask": "cabed613fdaf330a5576cc9ba0373e77",
        "maxFrameRate": "30000\/1000",
        "timeBase": "1\/90000",
        "maxBitRate": 5000,
        "resolutions": [
          {
            "width": 1280,
            "height": 720
          }
        ],
        "receiverRtcpEventLog": true
      }
    ]
  }
}

The Chromecast responds with an ANSWER :

{
  "answer": {
    "sendIndexes": [ 0, 1 ],
    "ssrcs": [ 306349, 866108 ],
    "udpPort": 36916
  },
  "result": "ok",
  "type": "ANSWER"
}

Chrome follows up with a PRESENTATION message on urn:x-cast:com.google.cast.webrtc(here I was browsing www.google.com) :

{
  "sessionId": "D9322EE6-C345-4B9D-E6E5-0B7370F7FBAA",
  "seqNum": 22790010,
  "type": "PRESENTATION",
  "title": "www.google.com (Tab)",
  "icons": [
    {
      "url": "https:\/\/www.google.com\/favicon.ico"
    }
  ]
}

And then sends a GET_STATUS on the media channel which returns the playing state (PLAYING) and a few other informations.

Then UDP traffic kicks in and the tab appears on the TV screen. I guess the OFFER/ANSWER cycle is somehow translated to its SDP counterpart but not knowing the WebRTC internals I cannot say much more.

Guia do colaborador