Janus VideoRoom信令分析--public、subscribe

1 public信令

//create获得session id,attach获得handle id,join获得participant id即user id。
//configure带sdp, type offer, 服务器应答带sdp, type answer。
异步消息:如join、configure都是通过事件event通知的。
同步消息:如create、attach都是直接返回结果。

1 {"janus":"create","transaction":"nhajpmyiqabB"} //client发给服务器janus

{
   "janus": "success",
   "transaction": "nhajpmyiqabB",
   "data": {
      "id": 7783258490937719
   }
}//服务器应答的
返的id是session id。
janus.js:1059 Created session: 7783258490937719

2 {"janus":"attach","plugin":"janus.plugin.videoroom","opaque_id":"videoroomtest-Aq1igEjqXNtQ","transaction":"P0kZ27HA2TQA"}

{
   "janus": "success",
   "session_id": 7783258490937719,
   "transaction": "P0kZ27HA2TQA",
   "data": {
      "id": 2494319352475519
   }
}
返的id是handle id。
janus.js:1390 Created handle: 2494319352475519


3 {"janus":"message","body":{"request":"join","room":1234,"ptype":"publisher","display":"ashley"},"transaction":"eJBPz33wXfiB"}

{
   "janus": "event",
   "session_id": 7783258490937719,
   "transaction": "eJBPz33wXfiB",
   "sender": 2494319352475519,
   "plugindata": {
      "plugin": "janus.plugin.videoroom",
      "data": {
         "videoroom": "joined",
         "room": 1234,
         "description": "Demo Room",
         "id": 5957630446341966,
         "private_id": 277486824,
         "publishers": []
      }
   }
}
id是participant id: 5957630446341966

   
4 {"janus":"message","body":{"request":"configure","audio":true,"video":true},"transaction":"cY6kikbFYH97","jsep":{"type":"offer","sdp":"v=0\r\n..."}}

{
   "janus": "event",
   "session_id": 7783258490937719,
   "transaction": "cY6kikbFYH97",
   "sender": 2494319352475519,
   "plugindata": {
      "plugin": "janus.plugin.videoroom",
      "data": {
         "videoroom": "event",
         "room": 1234,
         "configured": "ok",
         "audio_codec": "opus",
         "video_codec": "h264",
         "streams": [
            {
               "type": "audio",
               "mindex": 0,
               "mid": "0",
               "codec": "opus",
               "fec": true
            },
            {
               "type": "video",
               "mindex": 1,
               "mid": "1",
               "codec": "h264",
               "h264_profile": "42001f"
            }
         ]
      }
   },
   "jsep": {
      "type": "answer",
      "sdp": "v=0\r\n..."
   }
}

//candidate有好几条,有ip、port和type host
5  {"janus":"trickle","candidate":{"candidate":"candidate:253191485 1 udp 2122260223 192.168.0.199 63210 typ host generation 0 ufrag YGDN network-id 1","sdpMid":"0","sdpMLineIndex":0},"transaction":"o6qAgIV2FZwA"}
//Client发给server

{"janus":"trickle","candidate":{"completed":true},"transaction":"7FhMOHytkMpU"}
{
   "janus": "ack",
   "session_id": 7783258490937719,
   "transaction": "7FhMOHytkMpU"
}//Client发给server

6 
{
   "janus": "webrtcup",
   "session_id": 7783258490937719,
   "sender": 2494319352475519
}//S-->C

7
{
   "janus": "media",
   "session_id": 7783258490937719,
   "sender": 2494319352475519,
   "mid": "0",
   "type": "audio",
   "receiving": true
}

{
   "janus": "media",
   "session_id": 7783258490937719,
   "sender": 2494319352475519,
   "mid": "1",
   "type": "video",
   "receiving": true
}//S-->C

2 Subcribe信令

1 create 2 attach 3 join–subscriber 4 start
jane public join返回 participant id。
subscriber join 没有返回。join用private_id,private_id是joined返的。


//joined的"publishers"有值,newRemoteFeed(id, display, streams);
{"janus":"message","body":{"request":"join","room":1234,"ptype":"publisher","display":"jane"},"transaction":"ZhMPnUhXkZNQ"}

{
      "janus": "event",
      "session_id": 2700092514022925,
      "transaction": "ZhMPnUhXkZNQ",
      "sender": 8617577496500323,
      "plugindata": {
         "plugin": "janus.plugin.videoroom",
         "data": {
            "videoroom": "joined",
            "room": 1234,
            "description": "Demo Room",
            "id": 5102721899752203,
            "private_id": 888157627,
            "publishers": [
               {
                  "id": 5957630446341966,
                  "display": "ashley",
                  "audio_codec": "opus",
                  "video_codec": "h264",
                  "streams": [
                     {
                        "type": "audio",
                        "mindex": 0,
                        "mid": "0",
                        "codec": "opus",
                        "fec": true,
                        "talking": false
                     },
                     {
                        "type": "video",
                        "mindex": 1,
                        "mid": "1",
                        "codec": "h264",
                        "h264_profile": "42001f"
                     }
                  ],
                  "talking": false
               }
            ]
         }
      }
}

//feed是订阅那个的participant id,joined的"publishers"的值
//服务器应答attached,带sdp type offer
3 {"janus":"message","body":{"request":"join","room":1234,"ptype":"subscriber",
"streams":[{"feed":5957630446341966,"mid":"0"},{"feed":5957630446341966,"mid":"1"}],
"use_msid":false,"private_id":888157627},"transaction":"XR2YpVJrXkx3"}
{
   "janus": "event",
   "session_id": 2700092514022925,
   "transaction": "XR2YpVJrXkx3",
   "sender": 4702154964343509,
   "plugindata": {
      "plugin": "janus.plugin.videoroom",
      "data": {
         "videoroom": "attached",
         "room": 1234,
         "streams": [
            {
               "type": "audio",
               "active": true,
               "mindex": 0,
               "mid": "0",
               "ready": false,
               "send": true,
               "feed_id": 5957630446341966,
               "feed_display": "ashley",
               "feed_mid": "0",
               "codec": "opus"
            },
            {
               "type": "video",
               "active": true,
               "mindex": 1,
               "mid": "1",
               "ready": false,
               "send": true,
               "feed_id": 5957630446341966,
               "feed_display": "ashley",
               "feed_mid": "1",
               "codec": "h264",
               "h264-profile": "42001f"
            }
         ]
      }
   },
   "jsep": {
      "type": "offer",
      "sdp": "v=0\r\n ..."
   }
}

4 //sdp type answer
{"janus":"message","body":{"request":"start","room":1234},"transaction":"4sZok5Zkbnpv",
"jsep":{"type":"answer","sdp":"v=0\r\n ..."}}

{
      "janus": "event",
      "session_id": 2700092514022925,
      "transaction": "4sZok5Zkbnpv",
      "sender": 4702154964343509,
      "plugindata": {
         "plugin": "janus.plugin.videoroom",
         "data": {
            "videoroom": "event",
            "room": 1234,
            "started": "ok"
         }
      }
   }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值