正在显示
17 个修改的文件
包含
963 行增加
和
24 行删除
此 diff 太大无法显示。
docs/McuClient API.html
0 → 100644
| 1 | +<!DOCTYPE html> | ||
| 2 | +<html> | ||
| 3 | +<head> | ||
| 4 | +<title>McuClient API</title> | ||
| 5 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
| 6 | +<style type="text/css"> | ||
| 7 | +/* GitHub stylesheet for MarkdownPad (http://markdownpad.com) */ | ||
| 8 | +/* Author: Nicolas Hery - http://nicolashery.com */ | ||
| 9 | +/* Version: b13fe65ca28d2e568c6ed5d7f06581183df8f2ff */ | ||
| 10 | +/* Source: https://github.com/nicolahery/markdownpad-github */ | ||
| 11 | + | ||
| 12 | +/* RESET | ||
| 13 | +=============================================================================*/ | ||
| 14 | + | ||
| 15 | +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { | ||
| 16 | + margin: 0; | ||
| 17 | + padding: 0; | ||
| 18 | + border: 0; | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +/* BODY | ||
| 22 | +=============================================================================*/ | ||
| 23 | + | ||
| 24 | +body { | ||
| 25 | + font-family: Helvetica, arial, freesans, clean, sans-serif; | ||
| 26 | + font-size: 14px; | ||
| 27 | + line-height: 1.6; | ||
| 28 | + color: #333; | ||
| 29 | + background-color: #fff; | ||
| 30 | + padding: 20px; | ||
| 31 | + max-width: 960px; | ||
| 32 | + margin: 0 auto; | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +body>*:first-child { | ||
| 36 | + margin-top: 0 !important; | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +body>*:last-child { | ||
| 40 | + margin-bottom: 0 !important; | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +/* BLOCKS | ||
| 44 | +=============================================================================*/ | ||
| 45 | + | ||
| 46 | +p, blockquote, ul, ol, dl, table, pre { | ||
| 47 | + margin: 15px 0; | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +/* HEADERS | ||
| 51 | +=============================================================================*/ | ||
| 52 | + | ||
| 53 | +h1, h2, h3, h4, h5, h6 { | ||
| 54 | + margin: 20px 0 10px; | ||
| 55 | + padding: 0; | ||
| 56 | + font-weight: bold; | ||
| 57 | + -webkit-font-smoothing: antialiased; | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt, h5 code, h6 tt, h6 code { | ||
| 61 | + font-size: inherit; | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +h1 { | ||
| 65 | + font-size: 28px; | ||
| 66 | + color: #000; | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +h2 { | ||
| 70 | + font-size: 24px; | ||
| 71 | + border-bottom: 1px solid #ccc; | ||
| 72 | + color: #000; | ||
| 73 | +} | ||
| 74 | + | ||
| 75 | +h3 { | ||
| 76 | + font-size: 18px; | ||
| 77 | +} | ||
| 78 | + | ||
| 79 | +h4 { | ||
| 80 | + font-size: 16px; | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +h5 { | ||
| 84 | + font-size: 14px; | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +h6 { | ||
| 88 | + color: #777; | ||
| 89 | + font-size: 14px; | ||
| 90 | +} | ||
| 91 | + | ||
| 92 | +body>h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h4:first-child, body>h5:first-child, body>h6:first-child { | ||
| 93 | + margin-top: 0; | ||
| 94 | + padding-top: 0; | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 { | ||
| 98 | + margin-top: 0; | ||
| 99 | + padding-top: 0; | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | +h1+p, h2+p, h3+p, h4+p, h5+p, h6+p { | ||
| 103 | + margin-top: 10px; | ||
| 104 | +} | ||
| 105 | + | ||
| 106 | +/* LINKS | ||
| 107 | +=============================================================================*/ | ||
| 108 | + | ||
| 109 | +a { | ||
| 110 | + color: #4183C4; | ||
| 111 | + text-decoration: none; | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +a:hover { | ||
| 115 | + text-decoration: underline; | ||
| 116 | +} | ||
| 117 | + | ||
| 118 | +/* LISTS | ||
| 119 | +=============================================================================*/ | ||
| 120 | + | ||
| 121 | +ul, ol { | ||
| 122 | + padding-left: 30px; | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | +ul li > :first-child, | ||
| 126 | +ol li > :first-child, | ||
| 127 | +ul li ul:first-of-type, | ||
| 128 | +ol li ol:first-of-type, | ||
| 129 | +ul li ol:first-of-type, | ||
| 130 | +ol li ul:first-of-type { | ||
| 131 | + margin-top: 0px; | ||
| 132 | +} | ||
| 133 | + | ||
| 134 | +ul ul, ul ol, ol ol, ol ul { | ||
| 135 | + margin-bottom: 0; | ||
| 136 | +} | ||
| 137 | + | ||
| 138 | +dl { | ||
| 139 | + padding: 0; | ||
| 140 | +} | ||
| 141 | + | ||
| 142 | +dl dt { | ||
| 143 | + font-size: 14px; | ||
| 144 | + font-weight: bold; | ||
| 145 | + font-style: italic; | ||
| 146 | + padding: 0; | ||
| 147 | + margin: 15px 0 5px; | ||
| 148 | +} | ||
| 149 | + | ||
| 150 | +dl dt:first-child { | ||
| 151 | + padding: 0; | ||
| 152 | +} | ||
| 153 | + | ||
| 154 | +dl dt>:first-child { | ||
| 155 | + margin-top: 0px; | ||
| 156 | +} | ||
| 157 | + | ||
| 158 | +dl dt>:last-child { | ||
| 159 | + margin-bottom: 0px; | ||
| 160 | +} | ||
| 161 | + | ||
| 162 | +dl dd { | ||
| 163 | + margin: 0 0 15px; | ||
| 164 | + padding: 0 15px; | ||
| 165 | +} | ||
| 166 | + | ||
| 167 | +dl dd>:first-child { | ||
| 168 | + margin-top: 0px; | ||
| 169 | +} | ||
| 170 | + | ||
| 171 | +dl dd>:last-child { | ||
| 172 | + margin-bottom: 0px; | ||
| 173 | +} | ||
| 174 | + | ||
| 175 | +/* CODE | ||
| 176 | +=============================================================================*/ | ||
| 177 | + | ||
| 178 | +pre, code, tt { | ||
| 179 | + font-size: 12px; | ||
| 180 | + font-family: Consolas, "Liberation Mono", Courier, monospace; | ||
| 181 | +} | ||
| 182 | + | ||
| 183 | +code, tt { | ||
| 184 | + margin: 0 0px; | ||
| 185 | + padding: 0px 0px; | ||
| 186 | + white-space: nowrap; | ||
| 187 | + border: 1px solid #eaeaea; | ||
| 188 | + background-color: #f8f8f8; | ||
| 189 | + border-radius: 3px; | ||
| 190 | +} | ||
| 191 | + | ||
| 192 | +pre>code { | ||
| 193 | + margin: 0; | ||
| 194 | + padding: 0; | ||
| 195 | + white-space: pre; | ||
| 196 | + border: none; | ||
| 197 | + background: transparent; | ||
| 198 | +} | ||
| 199 | + | ||
| 200 | +pre { | ||
| 201 | + background-color: #f8f8f8; | ||
| 202 | + border: 1px solid #ccc; | ||
| 203 | + font-size: 13px; | ||
| 204 | + line-height: 19px; | ||
| 205 | + overflow: auto; | ||
| 206 | + padding: 6px 10px; | ||
| 207 | + border-radius: 3px; | ||
| 208 | +} | ||
| 209 | + | ||
| 210 | +pre code, pre tt { | ||
| 211 | + background-color: transparent; | ||
| 212 | + border: none; | ||
| 213 | +} | ||
| 214 | + | ||
| 215 | +kbd { | ||
| 216 | + -moz-border-bottom-colors: none; | ||
| 217 | + -moz-border-left-colors: none; | ||
| 218 | + -moz-border-right-colors: none; | ||
| 219 | + -moz-border-top-colors: none; | ||
| 220 | + background-color: #DDDDDD; | ||
| 221 | + background-image: linear-gradient(#F1F1F1, #DDDDDD); | ||
| 222 | + background-repeat: repeat-x; | ||
| 223 | + border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD; | ||
| 224 | + border-image: none; | ||
| 225 | + border-radius: 2px 2px 2px 2px; | ||
| 226 | + border-style: solid; | ||
| 227 | + border-width: 1px; | ||
| 228 | + font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; | ||
| 229 | + line-height: 10px; | ||
| 230 | + padding: 1px 4px; | ||
| 231 | +} | ||
| 232 | + | ||
| 233 | +/* QUOTES | ||
| 234 | +=============================================================================*/ | ||
| 235 | + | ||
| 236 | +blockquote { | ||
| 237 | + border-left: 4px solid #DDD; | ||
| 238 | + padding: 0 15px; | ||
| 239 | + color: #777; | ||
| 240 | +} | ||
| 241 | + | ||
| 242 | +blockquote>:first-child { | ||
| 243 | + margin-top: 0px; | ||
| 244 | +} | ||
| 245 | + | ||
| 246 | +blockquote>:last-child { | ||
| 247 | + margin-bottom: 0px; | ||
| 248 | +} | ||
| 249 | + | ||
| 250 | +/* HORIZONTAL RULES | ||
| 251 | +=============================================================================*/ | ||
| 252 | + | ||
| 253 | +hr { | ||
| 254 | + clear: both; | ||
| 255 | + margin: 15px 0; | ||
| 256 | + height: 0px; | ||
| 257 | + overflow: hidden; | ||
| 258 | + border: none; | ||
| 259 | + background: transparent; | ||
| 260 | + border-bottom: 4px solid #ddd; | ||
| 261 | + padding: 0; | ||
| 262 | +} | ||
| 263 | + | ||
| 264 | +/* TABLES | ||
| 265 | +=============================================================================*/ | ||
| 266 | + | ||
| 267 | +table th { | ||
| 268 | + font-weight: bold; | ||
| 269 | +} | ||
| 270 | + | ||
| 271 | +table th, table td { | ||
| 272 | + border: 1px solid #ccc; | ||
| 273 | + padding: 6px 13px; | ||
| 274 | +} | ||
| 275 | + | ||
| 276 | +table tr { | ||
| 277 | + border-top: 1px solid #ccc; | ||
| 278 | + background-color: #fff; | ||
| 279 | +} | ||
| 280 | + | ||
| 281 | +table tr:nth-child(2n) { | ||
| 282 | + background-color: #f8f8f8; | ||
| 283 | +} | ||
| 284 | + | ||
| 285 | +/* IMAGES | ||
| 286 | +=============================================================================*/ | ||
| 287 | + | ||
| 288 | +img { | ||
| 289 | + max-width: 100% | ||
| 290 | +} | ||
| 291 | +</style> | ||
| 292 | +</head> | ||
| 293 | +<body> | ||
| 294 | +<h1>McuClient API参考说明</h1> | ||
| 295 | + | ||
| 296 | +<p></p></p> | ||
| 297 | + | ||
| 298 | +<hr /> | ||
| 299 | + | ||
| 300 | +<h2>创建McuClient对象</h2> | ||
| 301 | + | ||
| 302 | +<p>只创建一次</p> | ||
| 303 | + | ||
| 304 | +<p>示例代码</p> | ||
| 305 | + | ||
| 306 | +<pre><code>window.onload=function(){ | ||
| 307 | + //创建client | ||
| 308 | + const client=MCUClientEngine.createMcuClient(); | ||
| 309 | + //获取事件监听消息定义 | ||
| 310 | + const MessageTypes=MCUClientEngine.MessageTypes; | ||
| 311 | +} | ||
| 312 | +</code></pre> | ||
| 313 | + | ||
| 314 | +<hr /> | ||
| 315 | + | ||
| 316 | +<h2>McuClient方法</h2> | ||
| 317 | + | ||
| 318 | +<h3>初始化</h3> | ||
| 319 | + | ||
| 320 | +<h4>client.init(configInfo)</h4> | ||
| 321 | + | ||
| 322 | +<p>client创建完成之后第一步需要初始化。</p> | ||
| 323 | + | ||
| 324 | +<p>示例代码</p> | ||
| 325 | + | ||
| 326 | +<pre><code>var paramInfo={ | ||
| 327 | + "meetingNumber":123456, | ||
| 328 | + "portal":"127.0.0.1:80", | ||
| 329 | + "usertRole":"normal", | ||
| 330 | + "userID":0, | ||
| 331 | +}; | ||
| 332 | +//初始化 | ||
| 333 | +client.init(paramInfo,onSuccess,onFailure); | ||
| 334 | + | ||
| 335 | +function onSuccess(callbackData){ | ||
| 336 | + //初始化成功回调 | ||
| 337 | + //{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1} | ||
| 338 | +}; | ||
| 339 | +function onFailure(callbackData){ | ||
| 340 | + //初始化失败回调 | ||
| 341 | +}; | ||
| 342 | +</code></pre> | ||
| 343 | + | ||
| 344 | +<div class="wy-table-responsive"><table border="1" class="docutils"> | ||
| 345 | + <colgroup> | ||
| 346 | + <col width="10%"> | ||
| 347 | + <col width="10%"> | ||
| 348 | + <col width="80%"> | ||
| 349 | + </colgroup> | ||
| 350 | + <tbody valign="mid"> | ||
| 351 | + <tr class="row-odd"> | ||
| 352 | + <td><p class="first last">参数名称</p></td> | ||
| 353 | + <td><p class="first last">类型</p></td> | ||
| 354 | + <td><p class="first last">该对象包含以下属性</p></td> | ||
| 355 | + </tr> | ||
| 356 | + <tr class="row-even"> | ||
| 357 | + <td rowspan="5">paramInfo</td> | ||
| 358 | + <td rowspan="5"><p class="first last">对象</p></td> | ||
| 359 | + | ||
| 360 | + </tr> | ||
| 361 | + <tr class="row-odd"> | ||
| 362 | + <td> | ||
| 363 | + <ul> | ||
| 364 | + <li>meetingNumber:(必选)Number </p>课堂号</li> | ||
| 365 | + </ul> | ||
| 366 | + </td> | ||
| 367 | + </tr> | ||
| 368 | + <tr class="row-odd"> | ||
| 369 | + <td> | ||
| 370 | + <ul> | ||
| 371 | + <li>portal:(必选)String </p>IP地址</li> | ||
| 372 | + </ul> | ||
| 373 | + </td> | ||
| 374 | + </tr> | ||
| 375 | + <tr class="row-odd"> | ||
| 376 | + <td> | ||
| 377 | + <ul> | ||
| 378 | + <li>usertRole:(可选) String </p> | ||
| 379 | + 用户的身份,5种类型,默认是normal | ||
| 380 | + ;host(主持人/老师)、presenter(主讲人)、assistant(助教)、normal(普通角色/学生),record(暂时没用)</li> | ||
| 381 | + </ul> | ||
| 382 | + </td> | ||
| 383 | + </tr> | ||
| 384 | + <tr class="row-odd"> | ||
| 385 | + <td> | ||
| 386 | + <ul> | ||
| 387 | + <li>userId:(可选) String </p> | ||
| 388 | + 第三方用户id,默认是0 | ||
| 389 | + </ul> | ||
| 390 | + </td> | ||
| 391 | + </tr> | ||
| 392 | + <tr class="row-odd"> | ||
| 393 | + <td><p class="first last">onSuccess</p></td> | ||
| 394 | + <td><p class="first last">Function</p></td> | ||
| 395 | + <td><p class="first last"><li>(必选) Function </p>初始化成功回调函数,返回值:</p>{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1} | ||
| 396 | + </td> | ||
| 397 | + </tr> | ||
| 398 | + <tr class="row-odd"> | ||
| 399 | + <td><p class="first last">onFailure</p></td> | ||
| 400 | + <td><p class="first last">Function</p></td> | ||
| 401 | + <td><p class="first last"><li>(必选) Function </p>初始化失败回调函数</p></td> | ||
| 402 | + </tr> | ||
| 403 | + </tbody> | ||
| 404 | +</table></div> | ||
| 405 | + | ||
| 406 | +<h3>加入会议</h3> | ||
| 407 | + | ||
| 408 | +<h4>client.joinClass(paramInfo)</h4> | ||
| 409 | + | ||
| 410 | +<p>client初始化成功之后,加入会议。</p> | ||
| 411 | + | ||
| 412 | +<p>示例代码</p> | ||
| 413 | + | ||
| 414 | +<pre><code>var paramInfo={ | ||
| 415 | + "userName":"大名",//自己的名字,在列表中显示 | ||
| 416 | + "password":"123321",//课堂密码,如果设置了密码需要验证 | ||
| 417 | +}; | ||
| 418 | + | ||
| 419 | +//加入会议 | ||
| 420 | +client.joinClass(paramInfo,onSuccess,onFailure); | ||
| 421 | + | ||
| 422 | +function onSuccess(callbackData){ | ||
| 423 | + //加入会议成功回调 | ||
| 424 | + //{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1} | ||
| 425 | +}; | ||
| 426 | +function onFailure(callbackData){ | ||
| 427 | + //加入会议失败回调 | ||
| 428 | + //MessageTypes.ERROR_PARAM 传入的参数错误 | ||
| 429 | + //MessageTypes.ERROR_CLASS_PASSWORD_WRONG 传入的参数错误 | ||
| 430 | + //MessageTypes.ERROR_CLASS_JOIN_FULL 课堂人数已满 | ||
| 431 | + //MessageTypes.ERROR_CLASS_PROTOCOL_WRONG 协议异常 | ||
| 432 | + //MessageTypes.ERROR_CLASS_MD5_WRONG MD5验证失败 | ||
| 433 | +}; | ||
| 434 | +</code></pre> | ||
| 435 | + | ||
| 436 | +<div class="wy-table-responsive"><table border="1" class="docutils"> | ||
| 437 | + <colgroup> | ||
| 438 | + <col width="10%"> | ||
| 439 | + <col width="10%"> | ||
| 440 | + <col width="80%"> | ||
| 441 | + </colgroup> | ||
| 442 | + <tbody valign="m"> | ||
| 443 | + <tr class="row-odd"> | ||
| 444 | + <td><p class="first last">参数名称</p></td> | ||
| 445 | + <td><p class="first last">类型</p></td> | ||
| 446 | + <td><p class="first last">该对象包含以下属性</p></td> | ||
| 447 | + </tr> | ||
| 448 | + <tr class="row-even"> | ||
| 449 | + <td rowspan="3">paramInfo</td> | ||
| 450 | + <td rowspan="3"><p class="first last">对象</p></td> | ||
| 451 | + | ||
| 452 | + </tr> | ||
| 453 | + <tr class="row-odd"> | ||
| 454 | + <td> | ||
| 455 | + <ul> | ||
| 456 | + <li>userName:(必选)String </p>进入课堂的名字</li> | ||
| 457 | + </ul> | ||
| 458 | + </td> | ||
| 459 | + </tr> | ||
| 460 | + | ||
| 461 | + <tr class="row-odd"> | ||
| 462 | + <td> | ||
| 463 | + <ul> | ||
| 464 | + <li>password:(可选)String </p>进入课堂的密码,如果课堂不设置密码就不需要,设置了密码的情况下,进入课堂需要输入密码,根据初始化回调的参数passwordRequired来判断</li> | ||
| 465 | + </ul> | ||
| 466 | + </td> | ||
| 467 | + </tr> | ||
| 468 | + <tr class="row-odd"> | ||
| 469 | + <td><p class="first last">onSuccess</p></td> | ||
| 470 | + <td><p class="first last">Function</p></td> | ||
| 471 | + <td><p class="first last"><li>(必选) Function </p>成功回调函数</p> | ||
| 472 | + </td> | ||
| 473 | + </tr> | ||
| 474 | + <tr class="row-odd"> | ||
| 475 | + <td><p class="first last">onFailure</p></td> | ||
| 476 | + <td><p class="first last">Function</p></td> | ||
| 477 | + <td><p class="first last"><li>(必选) Function </p>失败回调函数,返回值:</p> | ||
| 478 | + //MessageTypes.ERROR_PARAM 传入的参数错误 | ||
| 479 | + //MessageTypes.ERROR_CLASS_PASSWORD_WRONG 传入的参数错误 | ||
| 480 | + //MessageTypes.ERROR_CLASS_JOIN_FULL 课堂人数已满 | ||
| 481 | + //MessageTypes.ERROR_CLASS_PROTOCOL_WRONG 协议异常 | ||
| 482 | + //MessageTypes.ERROR_CLASS_MD5_WRONG MD5验证失败 | ||
| 483 | + </td> | ||
| 484 | + </tr> | ||
| 485 | + </tbody> | ||
| 486 | +</table></div> | ||
| 487 | + | ||
| 488 | +<h3>离开会议</h3> | ||
| 489 | + | ||
| 490 | +<h4>client.leaveClass()</h4> | ||
| 491 | + | ||
| 492 | +<p>离开会议</p> | ||
| 493 | + | ||
| 494 | +<h3>发送消息</h3> | ||
| 495 | + | ||
| 496 | +<h4>client.sendChatMsg(paramInfo)</h4> | ||
| 497 | + | ||
| 498 | +<p>发送聊天消息</p> | ||
| 499 | + | ||
| 500 | +<p>示例代码</p> | ||
| 501 | + | ||
| 502 | +<pre><code>var paramInfo={ | ||
| 503 | + "message":"需要发送的内容", | ||
| 504 | + "to":0 | ||
| 505 | + | ||
| 506 | +}; | ||
| 507 | +client.sendChatMsg(paramInfo); | ||
| 508 | +</code></pre> | ||
| 509 | + | ||
| 510 | +<div class="wy-table-responsive"><table border="1" class="docutils"> | ||
| 511 | + <colgroup> | ||
| 512 | + <col width="10%"> | ||
| 513 | + <col width="10%"> | ||
| 514 | + <col width="80%"> | ||
| 515 | + </colgroup> | ||
| 516 | + <tbody valign="top"> | ||
| 517 | + <tr class="row-odd"> | ||
| 518 | + <td><p class="first last">参数名称</p></td> | ||
| 519 | + <td><p class="first last">类型</p></td> | ||
| 520 | + <td><p class="first last">该对象包含以下属性</p></td> | ||
| 521 | + </tr> | ||
| 522 | + <tr class="row-even"> | ||
| 523 | + <td rowspan="11">paramInfo</td> | ||
| 524 | + <td rowspan="11"><p class="first last">对象</p></td> | ||
| 525 | + | ||
| 526 | + </tr> | ||
| 527 | + <tr class="row-odd"> | ||
| 528 | + <tr class="row-odd"> | ||
| 529 | + <td> | ||
| 530 | + <ul> | ||
| 531 | + <li>message:(必选)String </p>消息内容</li> | ||
| 532 | + </ul> | ||
| 533 | + </td> | ||
| 534 | + </tr> | ||
| 535 | + <td> | ||
| 536 | + <ul> | ||
| 537 | + <li>to:(可选) Number </p> | ||
| 538 | + 接收消息的人的ID,默认值是0(所有人都)</li> | ||
| 539 | + </ul> | ||
| 540 | + </td> | ||
| 541 | + </tr> | ||
| 542 | + </tbody> | ||
| 543 | +</table></div> | ||
| 544 | + | ||
| 545 | +<hr /> | ||
| 546 | + | ||
| 547 | +<h2>client回调事件</h2> | ||
| 548 | + | ||
| 549 | +<h3>显示日志信息 事件回调</h3> | ||
| 550 | + | ||
| 551 | +<p>示例代码</p> | ||
| 552 | + | ||
| 553 | +<pre><code>client.on(MessageTypes.CLASS_SHOW_DETAIL, function(callbackData){ | ||
| 554 | + //..... | ||
| 555 | +}); | ||
| 556 | +</code></pre> | ||
| 557 | + | ||
| 558 | +<h3>会议人数查询 事件回调</h3> | ||
| 559 | + | ||
| 560 | +<p>示例代码</p> | ||
| 561 | + | ||
| 562 | +<pre><code> client.on(MessageTypes.CLASS_SHOW_ROSTER_NUM,function(callbackData){ | ||
| 563 | + //..... | ||
| 564 | +}); | ||
| 565 | +</code></pre> | ||
| 566 | + | ||
| 567 | +<h3>关闭会议 事件回调</h3> | ||
| 568 | + | ||
| 569 | +<p>示例代码</p> | ||
| 570 | + | ||
| 571 | +<pre><code>client.on(MessageTypes.CLASS_EXIT, function(callbackData){ | ||
| 572 | + //..... | ||
| 573 | +}); | ||
| 574 | +</code></pre> | ||
| 575 | + | ||
| 576 | +<h3>收到聊天消息 事件回调</h3> | ||
| 577 | + | ||
| 578 | +<p>示例代码</p> | ||
| 579 | + | ||
| 580 | +<pre><code>client.on(MessageTypes.CHAT_RECEIVE, function(callbackData){ | ||
| 581 | + //{"fromNodeID":1484207995,"toNodeID":0,"message":"消息内容","fromName":"发送消息人的名字","fromRole":0} | ||
| 582 | +}); | ||
| 583 | +</code></pre> | ||
| 584 | + | ||
| 585 | +<h3>视频显示 事件回调</h3> | ||
| 586 | + | ||
| 587 | +<p>示例代码</p> | ||
| 588 | + | ||
| 589 | +<pre><code>client.on(MessageTypes.VIDEO_SHOW, function(callbackData){ | ||
| 590 | + //..... | ||
| 591 | +}); | ||
| 592 | +</code></pre> | ||
| 593 | + | ||
| 594 | +<h3>文档 事件回调</h3> | ||
| 595 | + | ||
| 596 | +<p>示例代码</p> | ||
| 597 | + | ||
| 598 | +<pre><code>client.on(MessageTypes.DOC_SHOW, function(callbackData){ | ||
| 599 | + //..... | ||
| 600 | +}); | ||
| 601 | +</code></pre> | ||
| 602 | + | ||
| 603 | +<h3>文档笔记 事件回调</h3> | ||
| 604 | + | ||
| 605 | +<p>示例代码</p> | ||
| 606 | + | ||
| 607 | +<pre><code>client.on(MessageTypes.DOC_ANNO,function(callbackData){ | ||
| 608 | + //..... | ||
| 609 | +}); | ||
| 610 | +</code></pre> | ||
| 611 | + | ||
| 612 | +<h3>删除文档 事件回调</h3> | ||
| 613 | + | ||
| 614 | +<p>示例代码</p> | ||
| 615 | + | ||
| 616 | +<pre><code> client.on(MessageTypes.DOC_DEL,function(callbackData){ | ||
| 617 | + //..... | ||
| 618 | +}); | ||
| 619 | +</code></pre> | ||
| 620 | + | ||
| 621 | +<h3>网络错误 事件回调</h3> | ||
| 622 | + | ||
| 623 | +<p>示例代码</p> | ||
| 624 | + | ||
| 625 | +<pre><code>client.on(MessageTypes.NET_ERROR,function(callbackData){ | ||
| 626 | + //..... | ||
| 627 | +}); | ||
| 628 | +</code></pre> | ||
| 629 | + | ||
| 630 | +</body> | ||
| 631 | +</html> | ||
| 632 | +<!-- This document was created with MarkdownPad, the Markdown editor for Windows (http://markdownpad.com) --> |
docs/McuClient API.md
0 → 100644
| 1 | +# McuClient API参考说明 # | ||
| 2 | +</p> | ||
| 3 | + | ||
| 4 | +---------- | ||
| 5 | + | ||
| 6 | +##创建McuClient对象 ## | ||
| 7 | +只创建一次 | ||
| 8 | + | ||
| 9 | +示例代码 | ||
| 10 | + | ||
| 11 | + window.onload=function(){ | ||
| 12 | + //创建client | ||
| 13 | + const client=MCUClientEngine.createMcuClient(); | ||
| 14 | + //获取事件监听消息定义 | ||
| 15 | + const MessageTypes=MCUClientEngine.MessageTypes; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | +---------- | ||
| 19 | +## McuClient方法 ## | ||
| 20 | +### 初始化 ### | ||
| 21 | +#### client.init(configInfo) #### | ||
| 22 | +client创建完成之后第一步需要初始化。 | ||
| 23 | + | ||
| 24 | +示例代码 | ||
| 25 | + | ||
| 26 | + var paramInfo={ | ||
| 27 | + "meetingNumber":123456, | ||
| 28 | + "portal":"127.0.0.1:80", | ||
| 29 | + "usertRole":"normal", | ||
| 30 | + "userID":0, | ||
| 31 | + }; | ||
| 32 | + //初始化 | ||
| 33 | + client.init(paramInfo,onSuccess,onFailure); | ||
| 34 | + | ||
| 35 | + function onSuccess(callbackData){ | ||
| 36 | + //初始化成功回调 | ||
| 37 | + //{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1} | ||
| 38 | + }; | ||
| 39 | + function onFailure(callbackData){ | ||
| 40 | + //初始化失败回调 | ||
| 41 | + }; | ||
| 42 | + | ||
| 43 | + | ||
| 44 | +<div class="wy-table-responsive"><table border="1" class="docutils"> | ||
| 45 | + <colgroup> | ||
| 46 | + <col width="10%"> | ||
| 47 | + <col width="10%"> | ||
| 48 | + <col width="80%"> | ||
| 49 | + </colgroup> | ||
| 50 | + <tbody valign="mid"> | ||
| 51 | + <tr class="row-odd"> | ||
| 52 | + <td><p class="first last">参数名称</p></td> | ||
| 53 | + <td><p class="first last">类型</p></td> | ||
| 54 | + <td><p class="first last">该对象包含以下属性</p></td> | ||
| 55 | + </tr> | ||
| 56 | + <tr class="row-even"> | ||
| 57 | + <td rowspan="5">paramInfo</td> | ||
| 58 | + <td rowspan="5"><p class="first last">对象</p></td> | ||
| 59 | + | ||
| 60 | + </tr> | ||
| 61 | + <tr class="row-odd"> | ||
| 62 | + <td> | ||
| 63 | + <ul> | ||
| 64 | + <li>meetingNumber:(必选)Number </p>课堂号</li> | ||
| 65 | + </ul> | ||
| 66 | + </td> | ||
| 67 | + </tr> | ||
| 68 | + <tr class="row-odd"> | ||
| 69 | + <td> | ||
| 70 | + <ul> | ||
| 71 | + <li>portal:(必选)String </p>IP地址</li> | ||
| 72 | + </ul> | ||
| 73 | + </td> | ||
| 74 | + </tr> | ||
| 75 | + <tr class="row-odd"> | ||
| 76 | + <td> | ||
| 77 | + <ul> | ||
| 78 | + <li>usertRole:(可选) String </p> | ||
| 79 | + 用户的身份,5种类型,默认是normal | ||
| 80 | + ;host(主持人/老师)、presenter(主讲人)、assistant(助教)、normal(普通角色/学生),record(暂时没用)</li> | ||
| 81 | + </ul> | ||
| 82 | + </td> | ||
| 83 | + </tr> | ||
| 84 | + <tr class="row-odd"> | ||
| 85 | + <td> | ||
| 86 | + <ul> | ||
| 87 | + <li>userId:(可选) String </p> | ||
| 88 | + 第三方用户id,默认是0 | ||
| 89 | + </ul> | ||
| 90 | + </td> | ||
| 91 | + </tr> | ||
| 92 | + <tr class="row-odd"> | ||
| 93 | + <td><p class="first last">onSuccess</p></td> | ||
| 94 | + <td><p class="first last">Function</p></td> | ||
| 95 | + <td><p class="first last"><li>(必选) Function </p>初始化成功回调函数,返回值:</p>{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1} | ||
| 96 | + </td> | ||
| 97 | + </tr> | ||
| 98 | + <tr class="row-odd"> | ||
| 99 | + <td><p class="first last">onFailure</p></td> | ||
| 100 | + <td><p class="first last">Function</p></td> | ||
| 101 | + <td><p class="first last"><li>(必选) Function </p>初始化失败回调函数</p></td> | ||
| 102 | + </tr> | ||
| 103 | + </tbody> | ||
| 104 | +</table></div> | ||
| 105 | + | ||
| 106 | + | ||
| 107 | + | ||
| 108 | +### 加入会议 ### | ||
| 109 | +#### client.joinClass(paramInfo) #### | ||
| 110 | +client初始化成功之后,加入会议。 | ||
| 111 | + | ||
| 112 | +示例代码 | ||
| 113 | + | ||
| 114 | + var paramInfo={ | ||
| 115 | + "userName":"大名",//自己的名字,在列表中显示 | ||
| 116 | + "password":"123321",//课堂密码,如果设置了密码需要验证 | ||
| 117 | + }; | ||
| 118 | + | ||
| 119 | + //加入会议 | ||
| 120 | + client.joinClass(paramInfo,onSuccess,onFailure); | ||
| 121 | + | ||
| 122 | + function onSuccess(callbackData){ | ||
| 123 | + //加入会议成功回调 | ||
| 124 | + //{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1} | ||
| 125 | + }; | ||
| 126 | + function onFailure(callbackData){ | ||
| 127 | + //加入会议失败回调 | ||
| 128 | + //MessageTypes.ERROR_PARAM 传入的参数错误 | ||
| 129 | + //MessageTypes.ERROR_CLASS_PASSWORD_WRONG 传入的参数错误 | ||
| 130 | + //MessageTypes.ERROR_CLASS_JOIN_FULL 课堂人数已满 | ||
| 131 | + //MessageTypes.ERROR_CLASS_PROTOCOL_WRONG 协议异常 | ||
| 132 | + //MessageTypes.ERROR_CLASS_MD5_WRONG MD5验证失败 | ||
| 133 | + }; | ||
| 134 | + | ||
| 135 | + | ||
| 136 | +<div class="wy-table-responsive"><table border="1" class="docutils"> | ||
| 137 | + <colgroup> | ||
| 138 | + <col width="10%"> | ||
| 139 | + <col width="10%"> | ||
| 140 | + <col width="80%"> | ||
| 141 | + </colgroup> | ||
| 142 | + <tbody valign="m"> | ||
| 143 | + <tr class="row-odd"> | ||
| 144 | + <td><p class="first last">参数名称</p></td> | ||
| 145 | + <td><p class="first last">类型</p></td> | ||
| 146 | + <td><p class="first last">该对象包含以下属性</p></td> | ||
| 147 | + </tr> | ||
| 148 | + <tr class="row-even"> | ||
| 149 | + <td rowspan="3">paramInfo</td> | ||
| 150 | + <td rowspan="3"><p class="first last">对象</p></td> | ||
| 151 | + | ||
| 152 | + </tr> | ||
| 153 | + <tr class="row-odd"> | ||
| 154 | + <td> | ||
| 155 | + <ul> | ||
| 156 | + <li>userName:(必选)String </p>进入课堂的名字</li> | ||
| 157 | + </ul> | ||
| 158 | + </td> | ||
| 159 | + </tr> | ||
| 160 | + | ||
| 161 | + <tr class="row-odd"> | ||
| 162 | + <td> | ||
| 163 | + <ul> | ||
| 164 | + <li>password:(可选)String </p>进入课堂的密码,如果课堂不设置密码就不需要,设置了密码的情况下,进入课堂需要输入密码,根据初始化回调的参数passwordRequired来判断</li> | ||
| 165 | + </ul> | ||
| 166 | + </td> | ||
| 167 | + </tr> | ||
| 168 | + <tr class="row-odd"> | ||
| 169 | + <td><p class="first last">onSuccess</p></td> | ||
| 170 | + <td><p class="first last">Function</p></td> | ||
| 171 | + <td><p class="first last"><li>(必选) Function </p>成功回调函数</p> | ||
| 172 | + </td> | ||
| 173 | + </tr> | ||
| 174 | + <tr class="row-odd"> | ||
| 175 | + <td><p class="first last">onFailure</p></td> | ||
| 176 | + <td><p class="first last">Function</p></td> | ||
| 177 | + <td><p class="first last"><li>(必选) Function </p>失败回调函数,返回值:</p> | ||
| 178 | + //MessageTypes.ERROR_PARAM 传入的参数错误 | ||
| 179 | + //MessageTypes.ERROR_CLASS_PASSWORD_WRONG 传入的参数错误 | ||
| 180 | + //MessageTypes.ERROR_CLASS_JOIN_FULL 课堂人数已满 | ||
| 181 | + //MessageTypes.ERROR_CLASS_PROTOCOL_WRONG 协议异常 | ||
| 182 | + //MessageTypes.ERROR_CLASS_MD5_WRONG MD5验证失败 | ||
| 183 | + </td> | ||
| 184 | + </tr> | ||
| 185 | + </tbody> | ||
| 186 | +</table></div> | ||
| 187 | + | ||
| 188 | +### 离开会议 ### | ||
| 189 | +#### client.leaveClass() #### | ||
| 190 | +离开会议 | ||
| 191 | + | ||
| 192 | +### 发送消息 ### | ||
| 193 | +#### client.sendChatMsg(paramInfo) #### | ||
| 194 | +发送聊天消息 | ||
| 195 | + | ||
| 196 | +示例代码 | ||
| 197 | + | ||
| 198 | + var paramInfo={ | ||
| 199 | + "message":"需要发送的内容", | ||
| 200 | + "to":0 | ||
| 201 | + | ||
| 202 | + }; | ||
| 203 | + client.sendChatMsg(paramInfo); | ||
| 204 | + | ||
| 205 | +<div class="wy-table-responsive"><table border="1" class="docutils"> | ||
| 206 | + <colgroup> | ||
| 207 | + <col width="10%"> | ||
| 208 | + <col width="10%"> | ||
| 209 | + <col width="80%"> | ||
| 210 | + </colgroup> | ||
| 211 | + <tbody valign="top"> | ||
| 212 | + <tr class="row-odd"> | ||
| 213 | + <td><p class="first last">参数名称</p></td> | ||
| 214 | + <td><p class="first last">类型</p></td> | ||
| 215 | + <td><p class="first last">该对象包含以下属性</p></td> | ||
| 216 | + </tr> | ||
| 217 | + <tr class="row-even"> | ||
| 218 | + <td rowspan="11">paramInfo</td> | ||
| 219 | + <td rowspan="11"><p class="first last">对象</p></td> | ||
| 220 | + | ||
| 221 | + </tr> | ||
| 222 | + <tr class="row-odd"> | ||
| 223 | + <tr class="row-odd"> | ||
| 224 | + <td> | ||
| 225 | + <ul> | ||
| 226 | + <li>message:(必选)String </p>消息内容</li> | ||
| 227 | + </ul> | ||
| 228 | + </td> | ||
| 229 | + </tr> | ||
| 230 | + <td> | ||
| 231 | + <ul> | ||
| 232 | + <li>to:(可选) Number </p> | ||
| 233 | + 接收消息的人的ID,默认值是0(所有人都)</li> | ||
| 234 | + </ul> | ||
| 235 | + </td> | ||
| 236 | + </tr> | ||
| 237 | + </tbody> | ||
| 238 | +</table></div> | ||
| 239 | + | ||
| 240 | +---------- | ||
| 241 | + | ||
| 242 | +## client回调事件 ## | ||
| 243 | + | ||
| 244 | + | ||
| 245 | +### 显示日志信息 事件回调 ### | ||
| 246 | +示例代码 | ||
| 247 | + | ||
| 248 | + client.on(MessageTypes.CLASS_SHOW_DETAIL, function(callbackData){ | ||
| 249 | + //..... | ||
| 250 | + }); | ||
| 251 | + | ||
| 252 | +### 会议人数查询 事件回调 ### | ||
| 253 | +示例代码 | ||
| 254 | + | ||
| 255 | + client.on(MessageTypes.CLASS_SHOW_ROSTER_NUM,function(callbackData){ | ||
| 256 | + //..... | ||
| 257 | + }); | ||
| 258 | + | ||
| 259 | +### 关闭会议 事件回调 ### | ||
| 260 | +示例代码 | ||
| 261 | + | ||
| 262 | + client.on(MessageTypes.CLASS_EXIT, function(callbackData){ | ||
| 263 | + //..... | ||
| 264 | + }); | ||
| 265 | + | ||
| 266 | +### 收到聊天消息 事件回调 ### | ||
| 267 | +示例代码 | ||
| 268 | + | ||
| 269 | + client.on(MessageTypes.CHAT_RECEIVE, function(callbackData){ | ||
| 270 | + //{"fromNodeID":1484207995,"toNodeID":0,"message":"消息内容","fromName":"发送消息人的名字","fromRole":0} | ||
| 271 | + }); | ||
| 272 | + | ||
| 273 | +### 视频显示 事件回调 ### | ||
| 274 | +示例代码 | ||
| 275 | + | ||
| 276 | + client.on(MessageTypes.VIDEO_SHOW, function(callbackData){ | ||
| 277 | + //..... | ||
| 278 | + }); | ||
| 279 | + | ||
| 280 | +### 文档 事件回调 ### | ||
| 281 | +示例代码 | ||
| 282 | + | ||
| 283 | + client.on(MessageTypes.DOC_SHOW, function(callbackData){ | ||
| 284 | + //..... | ||
| 285 | + }); | ||
| 286 | + | ||
| 287 | +### 文档笔记 事件回调 ### | ||
| 288 | +示例代码 | ||
| 289 | + | ||
| 290 | + client.on(MessageTypes.DOC_ANNO,function(callbackData){ | ||
| 291 | + //..... | ||
| 292 | + }); | ||
| 293 | + | ||
| 294 | +### 删除文档 事件回调 ### | ||
| 295 | +示例代码 | ||
| 296 | + | ||
| 297 | + client.on(MessageTypes.DOC_DEL,function(callbackData){ | ||
| 298 | + //..... | ||
| 299 | + }); | ||
| 300 | + | ||
| 301 | +### 网络错误 事件回调 ### | ||
| 302 | +示例代码 | ||
| 303 | + | ||
| 304 | + client.on(MessageTypes.NET_ERROR,function(callbackData){ | ||
| 305 | + //..... | ||
| 306 | + }); |
| 1 | { | 1 | { |
| 2 | "name": "", | 2 | "name": "", |
| 3 | "version": "1.0.1", | 3 | "version": "1.0.1", |
| 4 | - "description": "McuClient on H5", | ||
| 5 | - "main": "dist/main.js", | 4 | + "description": "McuClient", |
| 5 | + "McuClient": "dist/McuClient.js", | ||
| 6 | "directories": { | 6 | "directories": { |
| 7 | "doc": "docs", | 7 | "doc": "docs", |
| 8 | "test": "test" | 8 | "test": "test" |
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | "test": "test/index.js" | 11 | "test": "test/index.js" |
| 12 | }, | 12 | }, |
| 13 | "keywords": [ | 13 | "keywords": [ |
| 14 | - "LiveClass" | 14 | + "McuClient" |
| 15 | ], | 15 | ], |
| 16 | "author": "www.3mang.com", | 16 | "author": "www.3mang.com", |
| 17 | "license": "MIT", | 17 | "license": "MIT", |
| @@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
| 31 | "wbp": { | 31 | "wbp": { |
| 32 | "project": "umd", | 32 | "project": "umd", |
| 33 | "entries": { | 33 | "entries": { |
| 34 | - "main": "./McuClientEngine.js" | 34 | + "McuClient": "./McuClientEngine.js" |
| 35 | }, | 35 | }, |
| 36 | "source": "src/", | 36 | "source": "src/", |
| 37 | "build": "dist/" | 37 | "build": "dist/" |
| @@ -12,8 +12,9 @@ import EngineUtils from "EngineUtils"; | @@ -12,8 +12,9 @@ import EngineUtils from "EngineUtils"; | ||
| 12 | import GlobalConfig from 'GlobalConfig'; | 12 | import GlobalConfig from 'GlobalConfig'; |
| 13 | 13 | ||
| 14 | let loger = Loger.getLoger('MessageEntrance'); | 14 | let loger = Loger.getLoger('MessageEntrance'); |
| 15 | -let _sdkInfo={"version":"v1.0.0","author":"www.3mang.com"}; | 15 | +let _sdkInfo={"version":"v.1.0.1","author":"www.3mang.com"}; |
| 16 | 16 | ||
| 17 | +//APE | ||
| 17 | let _sass; | 18 | let _sass; |
| 18 | let _mcu ; | 19 | let _mcu ; |
| 19 | let _confer_ape; | 20 | let _confer_ape; |
| @@ -22,12 +23,15 @@ let _video_ape; | @@ -22,12 +23,15 @@ let _video_ape; | ||
| 22 | let _doc_ape; | 23 | let _doc_ape; |
| 23 | let _wb_ape; | 24 | let _wb_ape; |
| 24 | 25 | ||
| 26 | +//init callBack function | ||
| 25 | let _initSuccessCallBackFun; | 27 | let _initSuccessCallBackFun; |
| 26 | let _initFailureCallBackFun; | 28 | let _initFailureCallBackFun; |
| 27 | 29 | ||
| 30 | +//join callBack function | ||
| 28 | let _joinClassSuccessCallBackFun; | 31 | let _joinClassSuccessCallBackFun; |
| 29 | let _joinClassFailureCallBackFun; | 32 | let _joinClassFailureCallBackFun; |
| 30 | 33 | ||
| 34 | +//MCUClient 外部实例化主类 | ||
| 31 | export default class MessageEntrance extends Emiter { | 35 | export default class MessageEntrance extends Emiter { |
| 32 | constructor() { | 36 | constructor() { |
| 33 | super(); | 37 | super(); |
| @@ -13,14 +13,14 @@ | @@ -13,14 +13,14 @@ | ||
| 13 | // | 13 | // |
| 14 | // ////////////////////////////////////////////////////////////////////////////// | 14 | // ////////////////////////////////////////////////////////////////////////////// |
| 15 | 15 | ||
| 16 | -import pdu from 'pdu'; | 16 | +import pdu from 'pdus'; |
| 17 | import Emiter from 'Emiter'; | 17 | import Emiter from 'Emiter'; |
| 18 | import mcu from 'mcu'; | 18 | import mcu from 'mcu'; |
| 19 | import Loger from 'Loger'; | 19 | import Loger from 'Loger'; |
| 20 | import MessageTypes from 'MessageTypes'; | 20 | import MessageTypes from 'MessageTypes'; |
| 21 | import ApeConsts from './ApeConsts'; | 21 | import ApeConsts from './ApeConsts'; |
| 22 | import ArrayBufferUtil from 'libs/ArrayBufferUtil'; | 22 | import ArrayBufferUtil from 'libs/ArrayBufferUtil'; |
| 23 | -import PduConsts from 'pdu/PduConsts'; | 23 | +import PduConsts from 'pdus/PduConsts'; |
| 24 | 24 | ||
| 25 | // 日志对象 | 25 | // 日志对象 |
| 26 | const loger = Loger.getLoger('Ape'); | 26 | const loger = Loger.getLoger('Ape'); |
| @@ -244,7 +244,7 @@ export default class Ape extends Emiter { | @@ -244,7 +244,7 @@ export default class Ape extends Emiter { | ||
| 244 | let adapterItemPdu = new pdu['RCAdapterItemPdu']; | 244 | let adapterItemPdu = new pdu['RCAdapterItemPdu']; |
| 245 | adapterItemPdu.type = pdu.RCPDU_REG_REGISTER_KEY; | 245 | adapterItemPdu.type = pdu.RCPDU_REG_REGISTER_KEY; |
| 246 | 246 | ||
| 247 | - // pack register key pdu | 247 | + // pack register key pdus |
| 248 | let registerKeyPdu = new pdu['RCRegistryRegisterKeyPdu']; | 248 | let registerKeyPdu = new pdu['RCRegistryRegisterKeyPdu']; |
| 249 | registerKeyPdu.id = id; | 249 | registerKeyPdu.id = id; |
| 250 | registerKeyPdu.name = name; | 250 | registerKeyPdu.name = name; |
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | 15 | ||
| 16 | import Ape from './Ape'; | 16 | import Ape from './Ape'; |
| 17 | import ApeConsts from './ApeConsts'; | 17 | import ApeConsts from './ApeConsts'; |
| 18 | -import pdu from 'pdu'; | 18 | +import pdu from 'pdus'; |
| 19 | import Loger from 'Loger'; | 19 | import Loger from 'Loger'; |
| 20 | import MessageTypes from 'MessageTypes'; | 20 | import MessageTypes from 'MessageTypes'; |
| 21 | import EngineUtils from "EngineUtils"; | 21 | import EngineUtils from "EngineUtils"; |
| @@ -38,7 +38,7 @@ class ChatApe extends Ape { | @@ -38,7 +38,7 @@ class ChatApe extends Ape { | ||
| 38 | this.on(pdu.RCPDU_CHAT_SEND_DATA_REQUEST, this.chatMsgIncomingHandler.bind(this)); | 38 | this.on(pdu.RCPDU_CHAT_SEND_DATA_REQUEST, this.chatMsgIncomingHandler.bind(this)); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | - //chatMsgIncomingHandler(pdu) { | 41 | + //chatMsgIncomingHandler(pdus) { |
| 42 | // | 42 | // |
| 43 | //} | 43 | //} |
| 44 | 44 |
| @@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
| 16 | import Ape from './Ape'; | 16 | import Ape from './Ape'; |
| 17 | import ApeConsts from './ApeConsts'; | 17 | import ApeConsts from './ApeConsts'; |
| 18 | import MessageTypes from 'MessageTypes'; | 18 | import MessageTypes from 'MessageTypes'; |
| 19 | -import pdu from 'pdu'; | 19 | +import pdu from 'pdus'; |
| 20 | import { Zlib } from 'zlibjs/bin/zlib.min'; | 20 | import { Zlib } from 'zlibjs/bin/zlib.min'; |
| 21 | import UTF8 from 'utf-8'; | 21 | import UTF8 from 'utf-8'; |
| 22 | import Loger from 'Loger'; | 22 | import Loger from 'Loger'; |
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | 15 | ||
| 16 | import Ape from './Ape'; | 16 | import Ape from './Ape'; |
| 17 | import ApeConsts from './ApeConsts'; | 17 | import ApeConsts from './ApeConsts'; |
| 18 | -import pdu from 'pdu'; | 18 | +import pdu from 'pdus'; |
| 19 | import Loger from 'Loger'; | 19 | import Loger from 'Loger'; |
| 20 | import MessageTypes from 'MessageTypes'; | 20 | import MessageTypes from 'MessageTypes'; |
| 21 | 21 |
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | 15 | ||
| 16 | import Ape from './Ape'; | 16 | import Ape from './Ape'; |
| 17 | import ApeConsts from './ApeConsts'; | 17 | import ApeConsts from './ApeConsts'; |
| 18 | -import pdu from 'pdu'; | 18 | +import pdu from 'pdus'; |
| 19 | import Loger from 'Loger'; | 19 | import Loger from 'Loger'; |
| 20 | import MessageTypes from 'MessageTypes'; | 20 | import MessageTypes from 'MessageTypes'; |
| 21 | 21 | ||
| @@ -90,10 +90,7 @@ class VideoChat extends Ape { | @@ -90,10 +90,7 @@ class VideoChat extends Ape { | ||
| 90 | this.activeChannelId = videoChannelInfo.channelId; | 90 | this.activeChannelId = videoChannelInfo.channelId; |
| 91 | // AMS | 91 | // AMS |
| 92 | if (this._confInfo.msType === '1') { | 92 | if (this._confInfo.msType === '1') { |
| 93 | - | ||
| 94 | this.activeURL = `http://dazhi.3mang.com/live/${this._confInfo.confId}/${this._confInfo.confId}_${videoChannelInfo.channelId}_flash_cam_mic_aac/playlist.m3u8`; | 93 | this.activeURL = `http://dazhi.3mang.com/live/${this._confInfo.confId}/${this._confInfo.confId}_${videoChannelInfo.channelId}_flash_cam_mic_aac/playlist.m3u8`; |
| 95 | - | ||
| 96 | - | ||
| 97 | }else { | 94 | }else { |
| 98 | this.activeURL = `http://hls.3mang.com/live/${this._confInfo.confId}_${videoChannelInfo.channelId}_flash_cam_mic_aac/playlist.m3u8`; | 95 | this.activeURL = `http://hls.3mang.com/live/${this._confInfo.confId}_${videoChannelInfo.channelId}_flash_cam_mic_aac/playlist.m3u8`; |
| 99 | } | 96 | } |
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | 15 | ||
| 16 | import Ape from './Ape'; | 16 | import Ape from './Ape'; |
| 17 | import ApeConsts from './ApeConsts'; | 17 | import ApeConsts from './ApeConsts'; |
| 18 | -import pdu from 'pdu'; | 18 | +import pdu from 'pdus'; |
| 19 | import Loger from 'Loger'; | 19 | import Loger from 'Loger'; |
| 20 | import MessageTypes from 'MessageTypes'; | 20 | import MessageTypes from 'MessageTypes'; |
| 21 | import { Zlib } from 'zlibjs/bin/zlib.min'; | 21 | import { Zlib } from 'zlibjs/bin/zlib.min'; |
| @@ -4,9 +4,9 @@ import Emiter from 'Emiter'; | @@ -4,9 +4,9 @@ import Emiter from 'Emiter'; | ||
| 4 | import MessageTypes from 'MessageTypes'; | 4 | import MessageTypes from 'MessageTypes'; |
| 5 | import Loger from 'Loger'; | 5 | import Loger from 'Loger'; |
| 6 | import everSocket from 'everSocket'; | 6 | import everSocket from 'everSocket'; |
| 7 | -import pdu from 'pdu/index'; | ||
| 8 | -import PduType from 'pdu/PduType'; | ||
| 9 | -import PduConsts from 'pdu/PduConsts'; | 7 | +import pdu from 'pdus/index'; |
| 8 | +import PduType from 'pdus/PduType'; | ||
| 9 | +import PduConsts from 'pdus/PduConsts'; | ||
| 10 | import ApeConsts from 'apes/ApeConsts'; | 10 | import ApeConsts from 'apes/ApeConsts'; |
| 11 | import ConferApe from 'apes/ConferApe'; | 11 | import ConferApe from 'apes/ConferApe'; |
| 12 | import ArrayBufferUtil from 'libs/ArrayBufferUtil'; | 12 | import ArrayBufferUtil from 'libs/ArrayBufferUtil'; |
| @@ -54,7 +54,7 @@ class MCU extends Emiter { | @@ -54,7 +54,7 @@ class MCU extends Emiter { | ||
| 54 | descriptorPdu.capacity = 1; | 54 | descriptorPdu.capacity = 1; |
| 55 | joinRequestPdu.confDesc = descriptorPdu; | 55 | joinRequestPdu.confDesc = descriptorPdu; |
| 56 | 56 | ||
| 57 | - let pduMsg = pdu.create_connect_provider_request_pdu( | 57 | + let pduMsg = pdu.create_join_class_request_pdu( |
| 58 | joinRequestPdu.type, | 58 | joinRequestPdu.type, |
| 59 | confInfo.nodeId, | 59 | confInfo.nodeId, |
| 60 | confInfo.confId, | 60 | confInfo.confId, |
| @@ -103,12 +103,13 @@ class MCU extends Emiter { | @@ -103,12 +103,13 @@ class MCU extends Emiter { | ||
| 103 | } | 103 | } |
| 104 | break; | 104 | break; |
| 105 | case PduType.RCPDU_SEND_DATA_REQUEST: | 105 | case PduType.RCPDU_SEND_DATA_REQUEST: |
| 106 | + //先判断当前消息属于哪个APE 根据 sessionId来判断 | ||
| 106 | let ape = this._apes[pduMsg.sessionId]; | 107 | let ape = this._apes[pduMsg.sessionId]; |
| 107 | let sessionLabel = ApeConsts(pduMsg.sessionId); | 108 | let sessionLabel = ApeConsts(pduMsg.sessionId); |
| 108 | if (ape) { | 109 | if (ape) { |
| 109 | let subTypeLabel = pdu.id2type(pduMsg.subType); | 110 | let subTypeLabel = pdu.id2type(pduMsg.subType); |
| 110 | loger.log('MCU-SecondLayer封装消息', 'sessionId', sessionLabel, pduMsg.sessionId, 'subtype', subTypeLabel, pduMsg.subType); | 111 | loger.log('MCU-SecondLayer封装消息', 'sessionId', sessionLabel, pduMsg.sessionId, 'subtype', subTypeLabel, pduMsg.subType); |
| 111 | - loger.log("ape._emit("+pduMsg.subType+", "+pduMsg.data+")---------------------------"); | 112 | + //ape广播事件,只要ape中监听就能收到 |
| 112 | ape._emit(pduMsg.subType, pduMsg.data); | 113 | ape._emit(pduMsg.subType, pduMsg.data); |
| 113 | } else { | 114 | } else { |
| 114 | loger.warn(sessionLabel + '尚未注册'); | 115 | loger.warn(sessionLabel + '尚未注册'); |
| @@ -34,7 +34,6 @@ RCPduPackage.RCPDU_CHANNEL_LEAVE_REQUEST = 105; | @@ -34,7 +34,6 @@ RCPduPackage.RCPDU_CHANNEL_LEAVE_REQUEST = 105; | ||
| 34 | RCPduPackage.RCPDU_CHANNEL_RELEASE_REQUEST = 106; | 34 | RCPduPackage.RCPDU_CHANNEL_RELEASE_REQUEST = 106; |
| 35 | RCPduPackage.RCPDU_CHANNEL_RELEASE_INDICATION = 107; | 35 | RCPduPackage.RCPDU_CHANNEL_RELEASE_INDICATION = 107; |
| 36 | RCPduPackage.RCPDU_SEND_DATA_REQUEST = 120; | 36 | RCPduPackage.RCPDU_SEND_DATA_REQUEST = 120; |
| 37 | -RCPduPackage.RCPDU_SEND_DATA_REQUEST = 120; | ||
| 38 | RCPduPackage.RCPDU_SEND_DATA_INDICATION = 121; | 37 | RCPduPackage.RCPDU_SEND_DATA_INDICATION = 121; |
| 39 | RCPduPackage.RCPDU_UNIFORM_SEND_DATA_REQUEST = 125; | 38 | RCPduPackage.RCPDU_UNIFORM_SEND_DATA_REQUEST = 125; |
| 40 | RCPduPackage.RCPDU_UNIFORM_SEND_DATA_INDICATION = 126; | 39 | RCPduPackage.RCPDU_UNIFORM_SEND_DATA_INDICATION = 126; |
| @@ -32,7 +32,7 @@ pdu.decode_pdu = function (buffer) { | @@ -32,7 +32,7 @@ pdu.decode_pdu = function (buffer) { | ||
| 32 | return pdu['RCSendDataPdu'].decode(buffer); | 32 | return pdu['RCSendDataPdu'].decode(buffer); |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | -pdu.create_connect_provider_request_pdu = function ( | 35 | +pdu.create_join_class_request_pdu = function ( |
| 36 | sub_type, | 36 | sub_type, |
| 37 | initiator, | 37 | initiator, |
| 38 | conference_id, | 38 | conference_id, |
-
请 注册 或 登录 后发表评论