Skip to content

Instantly share code, notes, and snippets.

@leoncamel
Created May 9, 2019 12:39
Show Gist options
  • Save leoncamel/4fc242db03a6b0cf7feba923d8f391f1 to your computer and use it in GitHub Desktop.
Save leoncamel/4fc242db03a6b0cf7feba923d8f391f1 to your computer and use it in GitHub Desktop.
janus subscriber example

create

  • POST
{
    "janus":"create",
    "transaction":"GlYNX3Vv9eIX"
}
  • GET
[
   {
      "janus": "event",
      "session_id": 6876645124221370,
      "transaction": "CJzsCbwsIj1v",
      "sender": 7949415868307788,
      "plugindata": {
         "plugin": "janus.plugin.videoroom",
         "data": {
            "videoroom": "joined",
            "room": 1234,
            "description": "Demo Room",
            "id": 747460655827138,
            "private_id": 3093671221,
            "publishers": [
               {
                  "id": 7210562687624896,
                  "display": "user1",
                  "audio_codec": "opus",
                  "video_codec": "vp8",
                  "talking": false
               }
            ]
         }
      }
   }
]

attach plugin

  • POST
{
    "janus":"attach",
    "plugin":"janus.plugin.videoroom",
    "opaque_id":"videoroomtest-JhnmP82bxbuk",
    "transaction":"mamkooTyZ8rC"
}

join room

  • POST
{
    "janus":"message",
    "body":{
        "request":"join",
        "room":1234,
        "ptype":"publisher",
        "display":"user2"
    },
    "transaction":"CJzsCbwsIj1v"
}
  • GET
[
   {
      "janus": "event",
      "session_id": 6876645124221370,
      "transaction": "UYF980V4ET7a",
      "sender": 6993191487315596,
      "plugindata": {
         "plugin": "janus.plugin.videoroom",
         "data": {
            "videoroom": "attached",
            "room": 1234,
            "id": 7210562687624896,
            "display": "user1"
         }
      },
      "jsep": {
         "type": "offer",
         "sdp": "v=0\r\no=- 1557403284623526 1 IN IP4 188.213.167.189\r\ns=VideoRoom 1234\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS janus\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111\r\nc=IN IP4 188.213.167.189\r\na=sendonly\r\na=mid:audio\r\na=rtcp-mux\r\na=ice-ufrag:ts2A\r\na=ice-pwd:5LyBnODzGmtSxoo+sANJYd\r\na=ice-options:trickle\r\na=fingerprint:sha-256 D2:B9:31:8F:DF:24:D8:0E:ED:D2:EF:25:9E:AF:6F:B8:34:AE:53:9C:E6:F3:8F:F2:64:15:FA:E8:7F:53:2D:38\r\na=setup:actpass\r\na=rtpmap:111 opus/48000/2\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=ssrc:4082481462 cname:janus\r\na=ssrc:4082481462 msid:janus janusa0\r\na=ssrc:4082481462 mslabel:janus\r\na=ssrc:4082481462 label:janusa0\r\na=candidate:1 1 udp 2013266431 172.22.0.3 52596 typ host\r\na=candidate:2 1 udp 2013266431 172.18.0.2 58929 typ host\r\na=candidate:3 1 udp 2013266431 188.213.167.189 58049 typ host\r\na=end-of-candidates\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97\r\nc=IN IP4 188.213.167.189\r\na=sendonly\r\na=mid:video\r\na=rtcp-mux\r\na=ice-ufrag:ts2A\r\na=ice-pwd:5LyBnODzGmtSxoo+sANJYd\r\na=ice-options:trickle\r\na=fingerprint:sha-256 D2:B9:31:8F:DF:24:D8:0E:ED:D2:EF:25:9E:AF:6F:B8:34:AE:53:9C:E6:F3:8F:F2:64:15:FA:E8:7F:53:2D:38\r\na=setup:actpass\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtcp-fb:96 goog-remb\r\na=extmap:12 urn:3gpp:video-orientation\r\na=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=ssrc-group:FID 3951149351 2484571222\r\na=ssrc:3951149351 cname:janus\r\na=ssrc:3951149351 msid:janus janusv0\r\na=ssrc:3951149351 mslabel:janus\r\na=ssrc:3951149351 label:janusv0\r\na=ssrc:2484571222 cname:janus\r\na=ssrc:2484571222 msid:janus janusv0\r\na=ssrc:2484571222 mslabel:janus\r\na=ssrc:2484571222 label:janusv0\r\na=candidate:1 1 udp 2013266431 172.22.0.3 52596 typ host\r\na=candidate:2 1 udp 2013266431 172.18.0.2 58929 typ host\r\na=candidate:3 1 udp 2013266431 188.213.167.189 58049 typ host\r\na=end-of-candidates\r\n"
      }
   }
]

  • POST
{
    "janus":"attach",
    "plugin":"janus.plugin.videoroom",
    "opaque_id":"videoroomtest-JhnmP82bxbuk",
    "transaction":"MOPytHUjhvD7"
}
  • POST
{
    "janus":"message",
    "body":{
        "request":"join",
        "room":1234,
        "ptype":"subscriber",
        "feed":7210562687624896,
        "private_id":3093671221
        },
    "transaction":"UYF980V4ET7a"
}
  • GET
[
   {
      "janus": "event",
      "session_id": 6876645124221370,
      "transaction": "rCzVOeLhU6Un",
      "sender": 6993191487315596,
      "plugindata": {
         "plugin": "janus.plugin.videoroom",
         "data": {
            "videoroom": "event",
            "room": 1234,
            "started": "ok"
         }
      }
   }
]
  • POST
{
    "janus":"message",
    "body":{
        "request":"start",
        "room":1234
    },
    "transaction":"rCzVOeLhU6Un",
    "jsep":{
        "type":"answer",
        "sdp":"v=0\r\no=mozilla...THIS_IS_SDPARTA-66.0.5 3402265064029235090 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 4A:9F:70:56:0A:2F:85:DD:C6:82:77:F5:B0:67:D3:B2:4F:5C:48:7A:98:94:61:6E:F5:CB:6A:78:3E:ED:B4:47\r\na=group:BUNDLE audio video\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111\r\nc=IN IP4 0.0.0.0\r\na=recvonly\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=fmtp:111 maxplaybackrate=48000;stereo=1;useinbandfec=1\r\na=ice-pwd:54d2f8cd251c92b6af7c531d79a26348\r\na=ice-ufrag:0c7f9eb5\r\na=mid:audio\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=setup:active\r\na=ssrc:2185880013 cname:{329a7182-1ef1-1d40-82b8-01cdd9ec7e18}\r\nm=video 9 UDP/TLS/RTP/SAVPF 96\r\nc=IN IP4 0.0.0.0\r\na=recvonly\r\na=fmtp:96 max-fs=12288;max-fr=60\r\na=ice-pwd:54d2f8cd251c92b6af7c531d79a26348\r\na=ice-ufrag:0c7f9eb5\r\na=mid:video\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-mux\r\na=rtpmap:96 VP8/90000\r\na=setup:active\r\na=ssrc:4104427034 cname:{329a7182-1ef1-1d40-82b8-01cdd9ec7e18}\r\n"
    }
}

list of trickle

  • POST
{"janus":"trickle","candidate":{"candidate":"candidate:0 1 UDP 2122252543 192.168.0.161 56450 typ host","sdpMid":"audio","sdpMLineIndex":0},"transaction":"Ic85Li3hoT72"}
{"janus":"trickle","candidate":{"candidate":"candidate:2 1 TCP 2105524479 192.168.0.161 9 typ host tcptype active","sdpMid":"audio","sdpMLineIndex":0},"transaction":"Nql12xxTnGjN"}
{"janus":"trickle","candidate":{"candidate":"candidate:1 1 UDP 1686052863 116.236.218.154 49017 typ srflx raddr 192.168.0.161 rport 56450","sdpMid":"audio","sdpMLineIndex":0},"transaction":"cZVNVrkZQIDd"}
{"janus":"trickle","candidate":{"completed":true},"transaction":"p0dOe1xCgmpm"}
  • GET: webrtcup
[
   {
      "janus": "event",
      "session_id": 6876645124221370,
      "transaction": "py5fnsFllyvB",
      "sender": 7949415868307788,
      "plugindata": {
         "plugin": "janus.plugin.videoroom",
         "data": {
            "videoroom": "event",
            "room": 1234,
            "configured": "ok",
            "audio_codec": "opus",
            "video_codec": "vp8"
         }
      },
      "jsep": {
         "type": "answer",
         "sdp": "v=0\r\no=mozilla...THIS_IS_SDPARTA-66.0.5 1557403306758128 1 IN IP4 188.213.167.189\r\ns=VideoRoom 1234\r\nt=0 0\r\na=group:BUNDLE 0 1\r\na=msid-semantic: WMS janus\r\nm=audio 9 UDP/TLS/RTP/SAVPF 109\r\nc=IN IP4 188.213.167.189\r\na=recvonly\r\na=mid:0\r\na=rtcp-mux\r\na=ice-ufrag:X0oA\r\na=ice-pwd:AQmcWfw6izEL05O46Ybr3j\r\na=ice-options:trickle\r\na=fingerprint:sha-256 D2:B9:31:8F:DF:24:D8:0E:ED:D2:EF:25:9E:AF:6F:B8:34:AE:53:9C:E6:F3:8F:F2:64:15:FA:E8:7F:53:2D:38\r\na=setup:active\r\na=rtpmap:109 opus/48000/2\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=candidate:1 1 udp 2013266431 172.22.0.3 38243 typ host\r\na=candidate:2 1 udp 2013266431 172.18.0.2 44170 typ host\r\na=candidate:3 1 udp 2013266431 188.213.167.189 53933 typ host\r\na=end-of-candidates\r\nm=video 9 UDP/TLS/RTP/SAVPF 120\r\nc=IN IP4 188.213.167.189\r\na=recvonly\r\na=mid:1\r\na=rtcp-mux\r\na=ice-ufrag:X0oA\r\na=ice-pwd:AQmcWfw6izEL05O46Ybr3j\r\na=ice-options:trickle\r\na=fingerprint:sha-256 D2:B9:31:8F:DF:24:D8:0E:ED:D2:EF:25:9E:AF:6F:B8:34:AE:53:9C:E6:F3:8F:F2:64:15:FA:E8:7F:53:2D:38\r\na=setup:active\r\na=rtpmap:120 VP8/90000\r\na=rtcp-fb:120 ccm fir\r\na=rtcp-fb:120 nack\r\na=rtcp-fb:120 nack pli\r\na=rtcp-fb:120 goog-remb\r\na=rtcp-fb:120 transport-cc\r\na=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=candidate:1 1 udp 2013266431 172.22.0.3 38243 typ host\r\na=candidate:2 1 udp 2013266431 172.18.0.2 44170 typ host\r\na=candidate:3 1 udp 2013266431 188.213.167.189 53933 typ host\r\na=end-of-candidates\r\n"
      }
   },
   {
      "janus": "webrtcup",
      "session_id": 6876645124221370,
      "sender": 6993191487315596
   }
]

configure

  • POST
{
    "janus":"message",
    "body":{
        "request":"configure",
        "audio":true,
        "video":true
    },
    "transaction":"py5fnsFllyvB",
    "jsep":{
        "type":"offer",
        "sdp":"v=0\r\no=mozilla...THIS_IS_SDPARTA-66.0.5 4181122315775005167 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 AA:E2:44:76:8E:80:32:47:29:2B:E6:2A:45:80:20:FC:69:41:A6:3A:C4:F0:06:03:8B:73:1C:9A:89:6E:1B:4A\r\na=group:BUNDLE 0 1\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=audio 9 UDP/TLS/RTP/SAVPF 109 9 0 8 101\r\nc=IN IP4 0.0.0.0\r\na=sendonly\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2/recvonly urn:ietf:params:rtp-hdrext:csrc-audio-level\r\na=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1\r\na=fmtp:101 0-15\r\na=ice-pwd:f849db8c5f032242814c6e36a5bf1819\r\na=ice-ufrag:07218c09\r\na=mid:0\r\na=msid:{dc7c5677-f374-6c4a-8ac7-24c11a931f8b} {b299f440-9987-2846-9994-b5bd62fecb97}\r\na=rtcp-mux\r\na=rtpmap:109 opus/48000/2\r\na=rtpmap:9 G722/8000/1\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:101 telephone-event/8000/1\r\na=setup:actpass\r\na=ssrc:1577068901 cname:{70b5bf84-f545-5c4a-b199-8b81f9808096}\r\nm=video 9 UDP/TLS/RTP/SAVPF 120 121\r\nc=IN IP4 0.0.0.0\r\na=sendonly\r\na=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:4 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:5 urn:ietf:params:rtp-hdrext:toffset\r\na=fmtp:120 max-fs=12288;max-fr=60\r\na=fmtp:121 max-fs=12288;max-fr=60\r\na=ice-pwd:f849db8c5f032242814c6e36a5bf1819\r\na=ice-ufrag:07218c09\r\na=mid:1\r\na=msid:{dc7c5677-f374-6c4a-8ac7-24c11a931f8b} {982705a2-4a4e-c242-ab22-cca0bc2e8ad0}\r\na=rtcp-fb:120 nack\r\na=rtcp-fb:120 nack pli\r\na=rtcp-fb:120 ccm fir\r\na=rtcp-fb:120 goog-remb\r\na=rtcp-fb:121 nack\r\na=rtcp-fb:121 nack pli\r\na=rtcp-fb:121 ccm fir\r\na=rtcp-fb:121 goog-remb\r\na=rtcp-mux\r\na=rtpmap:120 VP8/90000\r\na=rtpmap:121 VP9/90000\r\na=setup:actpass\r\na=ssrc:2653926848 cname:{70b5bf84-f545-5c4a-b199-8b81f9808096}\r\n"
    }
}

list of trickles

  • POST
{"janus":"trickle","candidate":{"candidate":"candidate:0 1 UDP 2122252543 192.168.0.161 52731 typ host","sdpMid":"0","sdpMLineIndex":0},"transaction":"AT31xNDuT3T5"}
{"janus":"trickle","candidate":{"candidate":"candidate:2 1 TCP 2105524479 192.168.0.161 9 typ host tcptype active","sdpMid":"0","sdpMLineIndex":0},"transaction":"uvRSj9YaPCNB"}
{"janus":"trickle","candidate":{"candidate":"candidate:0 2 UDP 2122252542 192.168.0.161 51025 typ host","sdpMid":"0","sdpMLineIndex":0},"transaction":"vpJiKDmrDE3K"}
{"janus":"trickle","candidate":{"candidate":"candidate:2 2 TCP 2105524478 192.168.0.161 9 typ host tcptype active","sdpMid":"0","sdpMLineIndex":0},"transaction":"QdKilhsWWTI6"}
{"janus":"trickle","candidate":{"candidate":"candidate:0 1 UDP 2122252543 192.168.0.161 51539 typ host","sdpMid":"1","sdpMLineIndex":1},"transaction":"67HXBAu0zSym"}
{"janus":"trickle","candidate":{"candidate":"candidate:2 1 TCP 2105524479 192.168.0.161 9 typ host tcptype active","sdpMid":"1","sdpMLineIndex":1},"transaction":"nIwVWycugMmy"}
{"janus":"trickle","candidate":{"candidate":"candidate:0 2 UDP 2122252542 192.168.0.161 54292 typ host","sdpMid":"1","sdpMLineIndex":1},"transaction":"NKPys2ZXoHzM"}
{"janus":"trickle","candidate":{"candidate":"candidate:2 2 TCP 2105524478 192.168.0.161 9 typ host tcptype active","sdpMid":"1","sdpMLineIndex":1},"transaction":"CAHaipy5XvpU"}
{"janus":"trickle","candidate":{"candidate":"candidate:1 1 UDP 1686052863 116.236.218.154 49011 typ srflx raddr 192.168.0.161 rport 52731","sdpMid":"0","sdpMLineIndex":0},"transaction":"C0IRvZ7rVBhV"}
{"janus":"trickle","candidate":{"candidate":"candidate:1 1 UDP 1686052863 116.236.218.154 49010 typ srflx raddr 192.168.0.161 rport 51539","sdpMid":"1","sdpMLineIndex":1},"transaction":"607jhNUnsERW"}
{"janus":"trickle","candidate":{"candidate":"candidate:1 2 UDP 1686052862 116.236.218.154 10381 typ srflx raddr 192.168.0.161 rport 51025","sdpMid":"0","sdpMLineIndex":0},"transaction":"71KDJX4Tebpy"}
{"janus":"trickle","candidate":{"candidate":"candidate:1 2 UDP 1686052862 116.236.218.154 10382 typ srflx raddr 192.168.0.161 rport 54292","sdpMid":"1","sdpMLineIndex":1},"transaction":"yVVoOEJZ9ByC"}
{"janus":"trickle","candidate":{"completed":true},"transaction":"9fbBwdE4ErKA"}
  • GET
[
   {
      "janus": "webrtcup",
      "session_id": 6876645124221370,
      "sender": 7949415868307788
   }
]
[
   {
      "janus": "media",
      "session_id": 6876645124221370,
      "sender": 7949415868307788,
      "type": "audio",
      "receiving": true
   },
   {
      "janus": "media",
      "session_id": 6876645124221370,
      "sender": 7949415868307788,
      "type": "video",
      "receiving": true
   }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment