李勇

迁移文档

<!DOCTYPE html>
<html>
<head>
<title>McuClient_v.1.0.1_API</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
/* GitHub stylesheet for MarkdownPad (http://markdownpad.com) */
/* Author: Nicolas Hery - http://nicolashery.com */
/* Version: b13fe65ca28d2e568c6ed5d7f06581183df8f2ff */
/* Source: https://github.com/nicolahery/markdownpad-github */
/* RESET
=============================================================================*/
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 {
margin: 0;
padding: 0;
border: 0;
}
/* BODY
=============================================================================*/
body {
font-family: Helvetica, arial, freesans, clean, sans-serif;
font-size: 14px;
line-height: 1.6;
color: #333;
background-color: #fff;
padding: 20px;
max-width: 960px;
margin: 0 auto;
}
body>*:first-child {
margin-top: 0 !important;
}
body>*:last-child {
margin-bottom: 0 !important;
}
/* BLOCKS
=============================================================================*/
p, blockquote, ul, ol, dl, table, pre {
margin: 15px 0;
}
/* HEADERS
=============================================================================*/
h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}
h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt, h5 code, h6 tt, h6 code {
font-size: inherit;
}
h1 {
font-size: 28px;
color: #000;
}
h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
color: #777;
font-size: 14px;
}
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 {
margin-top: 0;
padding-top: 0;
}
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0;
}
h1+p, h2+p, h3+p, h4+p, h5+p, h6+p {
margin-top: 10px;
}
/* LINKS
=============================================================================*/
a {
color: #4183C4;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* LISTS
=============================================================================*/
ul, ol {
padding-left: 30px;
}
ul li > :first-child,
ol li > :first-child,
ul li ul:first-of-type,
ol li ol:first-of-type,
ul li ol:first-of-type,
ol li ul:first-of-type {
margin-top: 0px;
}
ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0;
}
dl {
padding: 0;
}
dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}
dl dt:first-child {
padding: 0;
}
dl dt>:first-child {
margin-top: 0px;
}
dl dt>:last-child {
margin-bottom: 0px;
}
dl dd {
margin: 0 0 15px;
padding: 0 15px;
}
dl dd>:first-child {
margin-top: 0px;
}
dl dd>:last-child {
margin-bottom: 0px;
}
/* CODE
=============================================================================*/
pre, code, tt {
font-size: 12px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
}
code, tt {
margin: 0 0px;
padding: 0px 0px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
}
pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent;
}
pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
}
pre code, pre tt {
background-color: transparent;
border: none;
}
kbd {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DDDDDD;
background-image: linear-gradient(#F1F1F1, #DDDDDD);
background-repeat: repeat-x;
border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD;
border-image: none;
border-radius: 2px 2px 2px 2px;
border-style: solid;
border-width: 1px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 10px;
padding: 1px 4px;
}
/* QUOTES
=============================================================================*/
blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777;
}
blockquote>:first-child {
margin-top: 0px;
}
blockquote>:last-child {
margin-bottom: 0px;
}
/* HORIZONTAL RULES
=============================================================================*/
hr {
clear: both;
margin: 15px 0;
height: 0px;
overflow: hidden;
border: none;
background: transparent;
border-bottom: 4px solid #ddd;
padding: 0;
}
/* TABLES
=============================================================================*/
table th {
font-weight: bold;
}
table th, table td {
border: 1px solid #ccc;
padding: 6px 13px;
}
table tr {
border-top: 1px solid #ccc;
background-color: #fff;
}
table tr:nth-child(2n) {
background-color: #f8f8f8;
}
/* IMAGES
=============================================================================*/
img {
max-width: 100%
}
</style>
</head>
<body>
<h1>McuClient API参考说明</h1>
<p></p></p>
<hr />
<h2><font color=blue>McuClient 目录</font></h2>
<blockquote>
<ul>
<li><p><strong>创建McuClient对象</strong></p></li>
<li><p><strong>McuClient接口</strong></p></li>
<li><p><strong>McuClient回调事件</strong></p></li>
<li><p><strong>ErrorCode 错误码查询</strong></p></li>
</ul>
</blockquote>
<hr />
<h2><font color=blue>使用步骤说明</font></h2>
<blockquote>
<ol>
<li>创建McuClient对象</li>
<li>McuClient初始化init</li>
<li>添加MessageTypes中的事件监听(接收各个模块的消息)</li>
<li>McuClient加入会议</li>
<li>加入会议成功之后可以调用其他接口和监听事件</li>
</ol>
</blockquote>
<hr />
<h2><font color=blue>创建McuClient对象</font></h2>
<p>只创建一次</p>
<p>示例代码</p>
<pre><code>window.onload=function(){
//创建client,这是必须的第一步
const client=MCUClientEngine.createMcuClient();
//获取事件监听消息定义
const MessageTypes=MCUClientEngine.MessageTypes;
}
</code></pre>
<hr />
<h2><font color=blue>McuClient接口 </font></h2>
<h3>初始化</h3>
<h4>client.init (paramInfo,onSuccess,mcuErrorEventHandler)</h4>
<p>client创建完成之后第一步需要初始化。</p>
<p>示例代码</p>
<pre><code>var paramInfo={
"meetingNumber":123456,
"portal":"127.0.0.1:80",
"usertRole":"normal",
"userID":0,
};
//初始化
client.init(paramInfo,onSuccess,mcuErrorEventHandler);
function onSuccess(callbackData){
//初始化成功回调
//{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1}
};
function mcuErrorEventHandler(callbackData){
//整个MCUClient中Error异常监听
//返回值callbackData的结构为{"code":errorCode,"reson":""}
//errorCode的列表在文档最后面的 ErrorCode错误码查询
};
</code></pre>
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="mid">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="5">paramInfo</td>
<td rowspan="5"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>meetingNumber:(必选)Number </p>课堂号</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>portal:(必选)String </p>IP地址</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>usertRole:(可选) String </p>
用户的身份,5种类型,默认是normal
;host(主持人/老师)、presenter(主讲人)、assistant(助教)、normal(普通角色/学生),record(暂时没用)</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>userId:(可选) String </p>
第三方用户id,默认是0
</ul>
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">onSuccess</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>初始化成功回调函数,返回值:</p>{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1}
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">mcuErrorEventHandler</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>整个MCUClient中Error异常监听</p></td>
</tr>
</tbody>
</table></div>
<h3>加入会议</h3>
<h4>client.joinClass (paramInfo,onSuccess)</h4>
<p>client初始化成功之后,加入会议。</p>
<p>示例代码</p>
<pre><code>var paramInfo={
"userName":"大名",//自己的名字,在列表中显示
"password":"123321",//课堂密码,如果设置了密码需要验证
};
//加入会议
client.joinClass(paramInfo,onSuccess);
function onSuccess(callbackData){
//加入会议成功回调
//{"siteId":"h5test","confId":1292388778,"h5Module":0,"nodeId":1484789938,"topNodeID":101,"userRole":"normal","role":1,"isHost":false,"classRole":0,"userId":"0","userName":"cccccc","password":"222222","userType":8,"passwordRequired":true,"md5":"b36da144521b70d89e72993cd1117b5b","msType":1,"portal":"112.126.80.182:80","mcuDelay":3000,"MCUServerIP":"123.56.73.119","MCUServerPort":"7001","maxVideoChannels":1,"maxAudioChannels":1,"maxMediaChannels":2}
};
</code></pre>
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="3">paramInfo</td>
<td rowspan="3"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>userName:(必选)String </p>进入课堂的名字</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>password:(可选)String </p>进入课堂的密码,如果课堂不设置密码就不需要,设置了密码的情况下,进入课堂需要输入密码,根据初始化回调的参数passwordRequired来判断</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">onSuccess</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>成功回调函数</p>
</td>
</tr>
</tbody>
</table></div>
<h3>离开会议</h3>
<h4>client.leaveClass()</h4>
<p>离开会议</p>
<h3>获取当前的状态</h3>
<h4>client.currentStatus()</h4>
<p>获取当前的状态</p>
<p>示例代码</p>
<pre><code>var callbackData=client.currentStatus();
//返回一个对象
//{code:0,message:"XXXXXX"}
</code></pre>
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">callbackData</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<tr class="row-odd">
<td>
<ul>
<li>code:Number </p></li>
0 //SDK 未初始化</p>
1 //未加入会议</p>
2 //已经加入会议</p>
3 //已经离开会议</p>
4 //未知状态
</ul>
</td>
</tr>
<td>
<ul>
<li>message:String </p>
状态的描述,对应code,默认为空</li>
</ul>
</td>
</tr>
</tbody>
</table></div>
<h3>发送消息</h3>
<h4>client.sendChatMsg(paramInfo)</h4>
<p>发送聊天消息</p>
<p>示例代码</p>
<pre><code>var paramInfo={
"message":"需要发送的内容",
"to":0
};
client.sendChatMsg(paramInfo);
</code></pre>
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="M">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">paramInfo</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<tr class="row-odd">
<td>
<ul>
<li>message:(必选)String </p>消息内容</li>
</ul>
</td>
</tr>
<td>
<ul>
<li>to:(可选) Number </p>
接收消息的人的ID,默认值是0(所有人都)</li>
</ul>
</td>
</tr>
</tbody>
</table></div>
<hr />
<h2><font color=blue>McuClient 回调事件 </font></h2>
<h3>会议日志信息 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.CLASS_SHOW_DETAIL, function(callbackData){
{
"repeatmonthweekweek": 0,
"endmode": 0,
"repeatweek": "",
"endcount": 1,
"errorCode": 0,
"cycle": 0,
"repeatmonthday": 0,
"frequency": 1,
"repeatday": 0,
"meetingName": "mcuClient",
"repeatmode": 0,
"finalenddate": "",
"meetingContent": "",
"beginTime": "2017-01-16 13:00:00",
"endTime": "2017-01-31 15:00:00",
"monthType": 0,
"category": "",
"repeatmonthweekday": 0,
"status": 1
</code></pre>
<p>}
});</p>
<h3>会议有人加入 事件回调</h3>
<p>示例代码</p>
<pre><code> client.on(MessageTypes.CLASS_INSERT_ROSTER,function(callbackData){
//返回值
//{"nodeId":1483947664,"nodeData":{"nodeId":1483947664,"name":"cccccc","role":1,"level":0,"audioRecords":[],"videoRecords":[],"status":null,"userData":{"qq":"","skype":"","mobile":""},"userId":"0","handUpTime":null,"deviceType":3,"mobileDirection":null}};
});
</code></pre>
<h3>会议有人离开 事件回调</h3>
<p>示例代码</p>
<pre><code> client.on(MessageTypes.CLASS_DELETE_ROSTER,function(callbackData){
//{"nodeId":1234}
});
</code></pre>
<h3>关闭会议 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.CLASS_EXIT, function(callbackData){
//.....
});
</code></pre>
<h3>收到聊天消息 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.CHAT_RECEIVE, function(callbackData){
//{"fromNodeID":1484207995,"toNodeID":0,"message":"消息内容","fromName":"发送消息人的名字","fromRole":0}
});
</code></pre>
<h3>视频显示 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.VIDEO_RECEIVE, function(callbackData){
//.....
});
</code></pre>
<h3>文档 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.DOC_SHOW, function(callbackData){
//.....
});
</code></pre>
<h3>文档笔记 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.DOC_ANNOTATION,function(callbackData){
//.....
});
</code></pre>
<h3>删除文档 事件回调</h3>
<p>示例代码</p>
<pre><code> client.on(MessageTypes.DOC_DELETE,function(callbackData){
//.....
});
</code></pre>
<hr />
<h2><font color=blue>ErrorCode 错误码查询</font></h2>
<pre><code>MessageTypes.ERR_NETWORK=10000;//网络错误
MessageTypes.ERR_UNKNOWN=10001;//未知错误
//会议初始化失败的几种情况
MessageTypes.ERR_CLASS_INIT_PAEAM=100;//初始化参数错误
MessageTypes.ERR_CLASS_INIT_NETWORK=101;//初始化网络错误
MessageTypes.ERR_CLASS_INIT_PROTOCOL=102;//初始化协议错误
MessageTypes.ERR_CLASS_INIT_FAILED=103;//初始化验证失败
//加入会议失败的几种情况
MessageTypes.ERR_CLASS_JOIN_NETWORK=200;//加入会议网络错误
MessageTypes.ERR_CLASS_JOIN_PROTOCOL=201;//加入会议化协议错误
MessageTypes.ERR_CLASS_JOIN_FAILED=202;//加入会议化异常错误
MessageTypes.ERR_CLASS_JOIN_PARAM=203;//加入会议参数错误
MessageTypes.ERR_CLASS_JOIN_FULL=204;//人数已满
MessageTypes.ERR_CLASS_MD5_WRONG=205;//MD5验证失败
MessageTypes.ERR_CLASS_PASSWORD_WRONG=206;//密码错误
MessageTypes.ERR_CLASS_JOIN_CONFILICT=207;//已经在其它地方登陆
MessageTypes.ERR_GET_CLASS_DETAIL=300;//获取classDetail失败
MessageTypes.ERR_GET_MEETING_PARAML=301;//获取MeetingParam失败
</code></pre>
</body>
</html>
<!-- This document was created with MarkdownPad, the Markdown editor for Windows (http://markdownpad.com) -->
# McuClient API参考说明 #
</p>
----------
##<font color=blue>McuClient 目录</font> ##
> - **创建McuClient对象**
>
> - **McuClient接口**
>
> - **McuClient回调事件**
>
> - **ErrorCode 错误码查询**
----------
##<font color=blue>使用步骤说明</font> ##
> 1. 创建McuClient对象
> 2. McuClient初始化init
> 3. 添加MessageTypes中的事件监听(接收各个模块的消息)
> 3. McuClient加入会议
> 4. 加入会议成功之后可以调用其他接口和监听事件
----------
##<font color=blue>创建McuClient对象</font> ##
只创建一次
示例代码
window.onload=function(){
//创建client,这是必须的第一步
const client=MCUClientEngine.createMcuClient();
//获取事件监听消息定义
const MessageTypes=MCUClientEngine.MessageTypes;
}
----------
## <font color=blue>McuClient接口 </font>##
### 初始化 ###
#### client.init (paramInfo,onSuccess,mcuErrorEventHandler) ####
client创建完成之后第一步需要初始化。
示例代码
var paramInfo={
"meetingNumber":123456,
"portal":"127.0.0.1:80",
"usertRole":"normal",
"userID":0,
};
//初始化
client.init(paramInfo,onSuccess,mcuErrorEventHandler);
function onSuccess(callbackData){
//初始化成功回调
//{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1}
};
function mcuErrorEventHandler(callbackData){
//整个MCUClient中Error异常监听
//返回值callbackData的结构为{"code":errorCode,"reson":""}
//errorCode的列表在文档最后面的 ErrorCode错误码查询
};
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="mid">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="5">paramInfo</td>
<td rowspan="5"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>meetingNumber:(必选)Number </p>课堂号</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>portal:(必选)String </p>IP地址</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>usertRole:(可选) String </p>
用户的身份,5种类型,默认是normal
;host(主持人/老师)、presenter(主讲人)、assistant(助教)、normal(普通角色/学生),record(暂时没用)</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>userId:(可选) String </p>
第三方用户id,默认是0
</ul>
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">onSuccess</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>初始化成功回调函数,返回值:</p>{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1}
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">mcuErrorEventHandler</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>整个MCUClient中Error异常监听</p></td>
</tr>
</tbody>
</table></div>
### 加入会议 ###
#### client.joinClass (paramInfo,onSuccess) ####
client初始化成功之后,加入会议。
示例代码
var paramInfo={
"userName":"大名",//自己的名字,在列表中显示
"password":"123321",//课堂密码,如果设置了密码需要验证
};
//加入会议
client.joinClass(paramInfo,onSuccess);
function onSuccess(callbackData){
//加入会议成功回调
//{"siteId":"h5test","confId":1292388778,"h5Module":0,"nodeId":1484789938,"topNodeID":101,"userRole":"normal","role":1,"isHost":false,"classRole":0,"userId":"0","userName":"cccccc","password":"222222","userType":8,"passwordRequired":true,"md5":"b36da144521b70d89e72993cd1117b5b","msType":1,"portal":"112.126.80.182:80","mcuDelay":3000,"MCUServerIP":"123.56.73.119","MCUServerPort":"7001","maxVideoChannels":1,"maxAudioChannels":1,"maxMediaChannels":2}
};
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="3">paramInfo</td>
<td rowspan="3"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>userName:(必选)String </p>进入课堂的名字</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>password:(可选)String </p>进入课堂的密码,如果课堂不设置密码就不需要,设置了密码的情况下,进入课堂需要输入密码,根据初始化回调的参数passwordRequired来判断</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">onSuccess</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>成功回调函数</p>
</td>
</tr>
</tbody>
</table></div>
### 离开会议 ###
#### client.leaveClass() ####
离开会议
### 获取当前的状态 ###
#### client.mcuClientStatus() ####
获取当前的状态
示例代码
var callbackData=client.mcuClientStatus();
//返回一个对象
//{code:0,message:"XXXXXX"}
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">callbackData</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<tr class="row-odd">
<td>
<ul>
<li>code:Number </p></li>
0 //SDK 未初始化</p>
1 //未加入会议</p>
2 //已经加入会议</p>
3 //已经离开会议</p>
4 //未知状态
</ul>
</td>
</tr>
<td>
<ul>
<li>message:String </p>
状态的描述,对应code,默认为空</li>
</ul>
</td>
</tr>
</tbody>
</table></div>
### 发送消息 ###
#### client.sendChatMsg(paramInfo) ####
发送聊天消息
示例代码
var paramInfo={
"message":"需要发送的内容",
"to":0
};
client.sendChatMsg(paramInfo);
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="M">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">paramInfo</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<tr class="row-odd">
<td>
<ul>
<li>message:(必选)String </p>消息内容</li>
</ul>
</td>
</tr>
<td>
<ul>
<li>to:(可选) Number </p>
接收消息的人的ID,默认值是0(所有人都)</li>
</ul>
</td>
</tr>
</tbody>
</table></div>
----------
## <font color=blue>McuClient 回调事件 </font>##
### 会议日志信息 事件回调 ###
示例代码
client.on(MessageTypes.CLASS_SHOW_DETAIL, function(callbackData){
//返回值
/*{
"repeatmonthweekweek": 0,
"endmode": 0,
"repeatweek": "",
"endcount": 1,
"errorCode": 0,
"cycle": 0,
"repeatmonthday": 0,
"frequency": 1,
"repeatday": 0,
"meetingName": "mcuClient",
"repeatmode": 0,
"finalenddate": "",
"meetingContent": "",
"beginTime": "2017-01-16 13:00:00",
"endTime": "2017-01-31 15:00:00",
"monthType": 0,
"category": "",
"repeatmonthweekday": 0,
"status": 1
}*/
});
### 会议有人加入 事件回调 ###
示例代码
client.on(MessageTypes.CLASS_INSERT_ROSTER,function(callbackData){
//返回值
//{"nodeId":1483947664,"nodeData":{"nodeId":1483947664,"name":"cccccc","role":1,"level":0,"audioRecords":[],"videoRecords":[],"status":null,"userData":{"qq":"","skype":"","mobile":""},"userId":"0","handUpTime":null,"deviceType":3,"mobileDirection":null}};
});
### 会议有人离开 事件回调 ###
示例代码
client.on(MessageTypes.CLASS_DELETE_ROSTER,function(callbackData){
//{"nodeId":1234}
});
### 关闭会议 事件回调 ###
示例代码
client.on(MessageTypes.CLASS_EXIT, function(callbackData){
//.....
});
### 收到聊天消息 事件回调 ###
示例代码
client.on(MessageTypes.CHAT_RECEIVE, function(callbackData){
//{"fromNodeID":1484207995,"toNodeID":0,"message":"消息内容","fromName":"发送消息人的名字","fromRole":0}
});
### 视频显示 事件回调 ###
示例代码
client.on(MessageTypes.VIDEO_RECEIVE, function(callbackData){
//.....
});
### 文档 事件回调 ###
示例代码
client.on(MessageTypes.DOC_SHOW, function(callbackData){
//.....
});
### 文档笔记 事件回调 ###
示例代码
client.on(MessageTypes.DOC_ANNOTATION,function(callbackData){
//.....
});
### 删除文档 事件回调 ###
示例代码
client.on(MessageTypes.DOC_DELETE,function(callbackData){
//.....
});
----------
## <font color=blue>ErrorCode 错误码查询</font> ##
<div class="wy-table-responsive">
<table border="1" class="docutils">
<colgroup>
<col width="14%">
<col width="10%">
<col width="76%">
</colgroup>
<tbody valign="M">
<tr class="row-odd">
<td><p class="first last">错误代码</p></td>
<td><p class="first last">值(code)</p></td>
<td><p class="first last">描述(reson)</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_PAEAM</td>
<td>100</td>
<td><p class="first last">初始化参数错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_NETWORK</td>
<td>101</td>
<td><p class="first last">初始化网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_PROTOCOL</td>
<td>102</td>
<td><p class="first last">初始化协议错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_FAILED</td>
<td>103</td>
<td><p class="first last">初始化验证失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_NETWORK</td>
<td>200</td>
<td><p class="first last">加入会议网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_PROTOCOL</td>
<td>201</td>
<td><p class="first last">加入会议化协议错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_FAILED</td>
<td>202</td>
<td><p class="first last">加入会议化异常错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_PARAM</td>
<td>203</td>
<td><p class="first last">加入会议参数错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_FULL</td>
<td>204</td>
<td><p class="first last">人数已满</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_MD5_WRONG</td>
<td>205</td>
<td><p class="first last">MD5验证失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_PASSWORD_WRONG</td>
<td>206</td>
<td><p class="first last">密码错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_CONFILICT</td>
<td>207</td>
<td><p class="first last">已经在其它地方登陆</p></td>
</tr>
<tr class="row-even">
<td>ERR_GET_CLASS_DETAIL</td>
<td>300</td>
<td><p class="first last">获取classDetail失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_GET_MEETING_PARAML</td>
<td>301</td>
<td><p class="first last">获取MeetingParam失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_NETWORK</td>
<td>10000</td>
<td><p class="first last">网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_UNKNOWN</td>
<td>10001</td>
<td><p class="first last">未知错误</p></td>
</tr>
</tbody>
</table>
</div>
\ No newline at end of file
不能预览此文件类型
<!DOCTYPE html>
<html>
<head>
<title>McuClient_v.1.0.2_API</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
/* GitHub stylesheet for MarkdownPad (http://markdownpad.com) */
/* Author: Nicolas Hery - http://nicolashery.com */
/* Version: b13fe65ca28d2e568c6ed5d7f06581183df8f2ff */
/* Source: https://github.com/nicolahery/markdownpad-github */
/* RESET
=============================================================================*/
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 {
margin: 0;
padding: 0;
border: 0;
}
/* BODY
=============================================================================*/
body {
font-family: Helvetica, arial, freesans, clean, sans-serif;
font-size: 14px;
line-height: 1.6;
color: #333;
background-color: #fff;
padding: 20px;
max-width: 960px;
margin: 0 auto;
}
body>*:first-child {
margin-top: 0 !important;
}
body>*:last-child {
margin-bottom: 0 !important;
}
/* BLOCKS
=============================================================================*/
p, blockquote, ul, ol, dl, table, pre {
margin: 15px 0;
}
/* HEADERS
=============================================================================*/
h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}
h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt, h5 code, h6 tt, h6 code {
font-size: inherit;
}
h1 {
font-size: 28px;
color: #000;
}
h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
color: #777;
font-size: 14px;
}
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 {
margin-top: 0;
padding-top: 0;
}
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0;
}
h1+p, h2+p, h3+p, h4+p, h5+p, h6+p {
margin-top: 10px;
}
/* LINKS
=============================================================================*/
a {
color: #4183C4;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* LISTS
=============================================================================*/
ul, ol {
padding-left: 30px;
}
ul li > :first-child,
ol li > :first-child,
ul li ul:first-of-type,
ol li ol:first-of-type,
ul li ol:first-of-type,
ol li ul:first-of-type {
margin-top: 0px;
}
ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0;
}
dl {
padding: 0;
}
dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}
dl dt:first-child {
padding: 0;
}
dl dt>:first-child {
margin-top: 0px;
}
dl dt>:last-child {
margin-bottom: 0px;
}
dl dd {
margin: 0 0 15px;
padding: 0 15px;
}
dl dd>:first-child {
margin-top: 0px;
}
dl dd>:last-child {
margin-bottom: 0px;
}
/* CODE
=============================================================================*/
pre, code, tt {
font-size: 12px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
}
code, tt {
margin: 0 0px;
padding: 0px 0px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
}
pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent;
}
pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
}
pre code, pre tt {
background-color: transparent;
border: none;
}
kbd {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DDDDDD;
background-image: linear-gradient(#F1F1F1, #DDDDDD);
background-repeat: repeat-x;
border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD;
border-image: none;
border-radius: 2px 2px 2px 2px;
border-style: solid;
border-width: 1px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 10px;
padding: 1px 4px;
}
/* QUOTES
=============================================================================*/
blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777;
}
blockquote>:first-child {
margin-top: 0px;
}
blockquote>:last-child {
margin-bottom: 0px;
}
/* HORIZONTAL RULES
=============================================================================*/
hr {
clear: both;
margin: 15px 0;
height: 0px;
overflow: hidden;
border: none;
background: transparent;
border-bottom: 4px solid #ddd;
padding: 0;
}
/* TABLES
=============================================================================*/
table th {
font-weight: bold;
}
table th, table td {
border: 1px solid #ccc;
padding: 6px 13px;
}
table tr {
border-top: 1px solid #ccc;
background-color: #fff;
}
table tr:nth-child(2n) {
background-color: #f8f8f8;
}
/* IMAGES
=============================================================================*/
img {
max-width: 100%
}
</style>
</head>
<body>
<h1>McuClient API参考说明</h1>
<p></p></p>
<hr />
<h2><font color=blue>McuClient 目录</font></h2>
<blockquote>
<ul>
<li><p><strong>创建McuClient对象</strong></p></li>
<li><p><strong>McuClient接口</strong></p></li>
<li><p><strong>McuClient回调事件</strong></p></li>
<li><p><strong>ErrorCode 错误码查询</strong></p></li>
</ul>
</blockquote>
<hr />
<h2><font color=blue>使用步骤说明</font></h2>
<blockquote>
<ol>
<li>创建McuClient对象</li>
<li>McuClient初始化init</li>
<li>添加MessageTypes中的事件监听(接收各个模块的消息)</li>
<li>McuClient加入会议</li>
<li>加入会议成功之后可以调用其他接口和监听事件</li>
</ol>
</blockquote>
<hr />
<h2><font color=blue>创建McuClient对象</font></h2>
<p>只创建一次</p>
<p>示例代码</p>
<pre><code>window.onload=function(){
//创建client,这是必须的第一步
const client=MCUClientEngine.createMcuClient();
//获取事件监听消息定义
const MessageTypes=MCUClientEngine.MessageTypes;
}
</code></pre>
<hr />
<h2><font color=blue>McuClient接口 </font></h2>
<h3>初始化</h3>
<h4>client.init (paramInfo,onSuccess,mcuErrorEventHandler)</h4>
<p>client创建完成之后第一步需要初始化。</p>
<p>示例代码</p>
<pre><code>var paramInfo={
"meetingNumber":123456,
"portal":"127.0.0.1:80",
"usertRole":"normal",
"userID":0,
};
//初始化
client.init(paramInfo,onSuccess,mcuErrorEventHandler);
function onSuccess(callbackData){
//初始化成功回调
/*{
"siteId": "h5test",
"passwordRequired": true,
"md5": "de399d5540b3da2fbc1eb0a770d4fd66",
"code": 0,
"msType": 1
}*/
};
function mcuErrorEventHandler(callbackData){
//整个MCUClient中Error异常监听
//返回值callbackData的结构为{"code":errorCode,"reson":""}
//errorCode的列表在文档最后面的 ErrorCode错误码查询
};
</code></pre>
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="mid">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="5">paramInfo</td>
<td rowspan="5"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>meetingNumber:(必选)Number </p>课堂号</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>portal:(必选)String </p>IP地址</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>usertRole:(可选) String </p>
用户的身份,5种类型,默认是normal
;host(主持人/老师)、presenter(主讲人)、assistant(助教)、normal(普通角色/学生),record(暂时没用)</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>userId:(可选) String </p>
第三方用户id,默认是0
</ul>
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">onSuccess</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>初始化成功回调函数,返回值:</p>{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1}
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">mcuErrorEventHandler</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>整个MCUClient中Error异常监听</p></td>
</tr>
</tbody>
</table></div>
<h3>加入会议</h3>
<h4>client.joinClass (paramInfo,onSuccess)</h4>
<p>client初始化成功之后,加入会议。</p>
<p>示例代码</p>
<pre><code>var paramInfo={
"userName":"大名",//自己的名字,在列表中显示
"password":"123321",//课堂密码,如果设置了密码需要验证
};
//加入会议
client.joinClass(paramInfo,onSuccess);
function onSuccess(callbackData){
//加入会议成功回调
/*{
"siteId": "h5test",
"confId": 1292388778,
"h5Module": 0,
"nodeId": 1484789938,
"topNodeID": 101,
"userRole": "normal",
"role": 1,
"isHost": false,
"classRole": 0,
"userId": "0",
"userName": "cccccc",
"password": "222222",
"userType": 8,
"passwordRequired": true,
"md5": "b36da144521b70d89e72993cd1117b5b",
"msType": 1,
"portal": "112.126.80.182:80",
"mcuDelay": 3000,
"MCUServerIP": "123.56.73.119",
"MCUServerPort": "7001",
"maxVideoChannels": 1,
"maxAudioChannels": 1,
"maxMediaChannels": 2
}*/
};
</code></pre>
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="3">paramInfo</td>
<td rowspan="3"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>userName:(必选)String </p>进入课堂的名字</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>password:(可选)String </p>进入课堂的密码,如果课堂不设置密码就不需要,设置了密码的情况下,进入课堂需要输入密码,根据初始化回调的参数passwordRequired来判断</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">onSuccess</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>成功回调函数</p>
</td>
</tr>
</tbody>
</table></div>
<h3>离开会议</h3>
<h4>client.leaveClass()</h4>
<p>离开会议</p>
<h3>获取当前的状态</h3>
<h4>client.mcuClientStatus()</h4>
<p>获取当前的状态</p>
<p>示例代码</p>
<pre><code>var callbackData=client.mcuClientStatus();
//返回一个对象
//{code:0,message:"XXXXXX"}
</code></pre>
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">callbackData</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<tr class="row-odd">
<td>
<ul>
<li>code:Number </p></li>
0 //SDK 未初始化</p>
1 //未加入会议</p>
2 //已经加入会议</p>
3 //已经离开会议</p>
4 //未知状态
</ul>
</td>
</tr>
<td>
<ul>
<li>message:String </p>
状态的描述,对应code,默认为空</li>
</ul>
</td>
</tr>
</tbody>
</table></div>
<h3>发送消息</h3>
<h4>client.sendChatMsg(paramInfo)</h4>
<p>发送聊天消息</p>
<p>示例代码</p>
<pre><code>var paramInfo={
"message":"需要发送的内容",
"to":0
};
client.sendChatMsg(paramInfo);
</code></pre>
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="M">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">paramInfo</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<tr class="row-odd">
<td>
<ul>
<li>message:(必选)String </p>消息内容</li>
</ul>
</td>
</tr>
<td>
<ul>
<li>to:(可选) Number </p>
接收消息的人的ID,默认值是0(所有人都)</li>
</ul>
</td>
</tr>
</tbody>
</table></div>
<hr />
<h2><font color=blue>McuClient 回调事件 </font></h2>
<h3>会议日志信息 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.CLASS_SHOW_DETAIL, function(callbackData){
//返回值
/*{
"repeatmonthweekweek": 0,
"endmode": 0,
"repeatweek": "",
"endcount": 1,
"errorCode": 0,
"cycle": 0,
"repeatmonthday": 0,
"frequency": 1,
"repeatday": 0,
"meetingName": "mcuClient",
"repeatmode": 0,
"finalenddate": "",
"meetingContent": "",
"beginTime": "2017-01-16 13:00:00",
"endTime": "2017-01-31 15:00:00",
"monthType": 0,
"category": "",
"repeatmonthweekday": 0,
"status": 1
}*/
});
</code></pre>
<h3>会议有人加入 事件回调</h3>
<p>示例代码</p>
<pre><code> client.on(MessageTypes.CLASS_INSERT_ROSTER,function(callbackData){
//返回值
/*{
"nodeId": 1483947664,
"nodeData": {
"nodeId": 1483947664,
"name": "cccccc",
"role": 1,
"level": 0,
"audioRecords": [],
"videoRecords": [],
"status": null,
"userData": {
"qq": "",
"skype": "",
"mobile": ""
},
"userId": "0",
"handUpTime": null,
"deviceType": 3,
"mobileDirection": null
}
}*/
});
</code></pre>
<h3>会议有人离开 事件回调</h3>
<p>示例代码</p>
<pre><code> client.on(MessageTypes.CLASS_DELETE_ROSTER,function(callbackData){
//{"nodeId":1234}
});
</code></pre>
<h3>关闭会议 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.CLASS_EXIT, function(callbackData){
//.....
});
</code></pre>
<h3>收到聊天消息 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.CHAT_RECEIVE, function(callbackData){
//返回值
/*{
"fromNodeID": 1484207995,
"toNodeID": 0,
"message": "消息内容",
"fromName": "发送消息人的名字",
"fromRole": 0
}*/
});
</code></pre>
<h3>视频显示 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.VIDEO_RECEIVE, function(callbackData){
//.....
});
</code></pre>
<h3>文档 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.DOC_SHOW, function(callbackData){
//.....
});
</code></pre>
<h3>文档笔记 事件回调</h3>
<p>示例代码</p>
<pre><code>client.on(MessageTypes.DOC_ANNOTATION,function(callbackData){
//.....
});
</code></pre>
<h3>删除文档 事件回调</h3>
<p>示例代码</p>
<pre><code> client.on(MessageTypes.DOC_DELETE,function(callbackData){
//.....
});
</code></pre>
<hr />
<h2><font color=blue>ErrorCode 错误码查询</font></h2>
<div class="wy-table-responsive">
<table border="1" class="docutils">
<colgroup>
<col width="14%">
<col width="10%">
<col width="76%">
</colgroup>
<tbody valign="M">
<tr class="row-odd">
<td><p class="first last">错误代码</p></td>
<td><p class="first last">值(code)</p></td>
<td><p class="first last">描述(reson)</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_PAEAM</td>
<td>100</td>
<td><p class="first last">初始化参数错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_NETWORK</td>
<td>101</td>
<td><p class="first last">初始化网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_PROTOCOL</td>
<td>102</td>
<td><p class="first last">初始化协议错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_FAILED</td>
<td>103</td>
<td><p class="first last">初始化验证失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_NETWORK</td>
<td>200</td>
<td><p class="first last">加入会议网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_PROTOCOL</td>
<td>201</td>
<td><p class="first last">加入会议化协议错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_FAILED</td>
<td>202</td>
<td><p class="first last">加入会议化异常错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_PARAM</td>
<td>203</td>
<td><p class="first last">加入会议参数错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_FULL</td>
<td>204</td>
<td><p class="first last">人数已满</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_MD5_WRONG</td>
<td>205</td>
<td><p class="first last">MD5验证失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_PASSWORD_WRONG</td>
<td>206</td>
<td><p class="first last">密码错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_CONFILICT</td>
<td>207</td>
<td><p class="first last">已经在其它地方登陆</p></td>
</tr>
<tr class="row-even">
<td>ERR_GET_CLASS_DETAIL</td>
<td>300</td>
<td><p class="first last">获取classDetail失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_GET_MEETING_PARAML</td>
<td>301</td>
<td><p class="first last">获取MeetingParam失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_NETWORK</td>
<td>10000</td>
<td><p class="first last">网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_UNKNOWN</td>
<td>10001</td>
<td><p class="first last">未知错误</p></td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
<!-- This document was created with MarkdownPad, the Markdown editor for Windows (http://markdownpad.com) -->
# McuClient API参考说明 #
</p>
----------
##<font color=blue>McuClient 目录</font> ##
> - **创建McuClient对象**
>
> - **McuClient接口**
>
> - **McuClient回调事件**
>
> - **ErrorCode 错误码查询**
----------
##<font color=blue>使用步骤说明</font> ##
> 1. 创建McuClient对象
> 2. McuClient初始化init
> 3. 添加MessageTypes中的事件监听(接收各个模块的消息)
> 3. McuClient加入会议
> 4. 加入会议成功之后可以调用其他接口和监听事件
----------
##<font color=blue>创建McuClient对象</font> ##
只创建一次
示例代码
window.onload=function(){
//创建client,这是必须的第一步
const client=MCUClientEngine.createMcuClient();
//获取事件监听消息定义
const MessageTypes=MCUClientEngine.MessageTypes;
}
----------
## <font color=blue>McuClient接口 </font>##
### 初始化 ###
#### client.init (paramInfo,onSuccess,mcuErrorEventHandler) ####
client创建完成之后第一步需要初始化。
示例代码
var paramInfo={
"meetingNumber":123456,
"portal":"127.0.0.1:80",
"usertRole":"normal",
"userID":0,
};
//初始化
client.init(paramInfo,onSuccess,mcuErrorEventHandler);
function onSuccess(callbackData){
//初始化成功回调
/*{
"siteId": "h5test",
"passwordRequired": true,
"md5": "de399d5540b3da2fbc1eb0a770d4fd66",
"code": 0,
"msType": 1
}*/
};
function mcuErrorEventHandler(callbackData){
//整个MCUClient中Error异常监听
//返回值callbackData的结构为{"code":errorCode,"reson":""}
//errorCode的列表在文档最后面的 ErrorCode错误码查询
};
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="mid">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="5">paramInfo</td>
<td rowspan="5"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>meetingNumber:(必选)Number </p>课堂号</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>portal:(必选)String </p>IP地址</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>usertRole:(可选) String </p>
用户的身份,5种类型,默认是normal
;host(主持人/老师)、presenter(主讲人)、assistant(助教)、normal(普通角色/学生),record(暂时没用)</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>userId:(可选) String </p>
第三方用户id,默认是0
</ul>
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">onSuccess</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>初始化成功回调函数,返回值:</p>{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1}
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">mcuErrorEventHandler</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>整个MCUClient中Error异常监听</p></td>
</tr>
</tbody>
</table></div>
### 加入会议 ###
#### client.joinClass (paramInfo,onSuccess) ####
client初始化成功之后,加入会议。
示例代码
var paramInfo={
"userName":"大名",//自己的名字,在列表中显示
"password":"123321",//课堂密码,如果设置了密码需要验证
};
//加入会议
client.joinClass(paramInfo,onSuccess);
function onSuccess(callbackData){
//加入会议成功回调
/*{
"siteId": "h5test",
"confId": 1292388778,
"h5Module": 0,
"nodeId": 1484789938,
"topNodeID": 101,
"userRole": "normal",
"role": 1,
"isHost": false,
"classRole": 0,
"userId": "0",
"userName": "cccccc",
"password": "222222",
"userType": 8,
"passwordRequired": true,
"md5": "b36da144521b70d89e72993cd1117b5b",
"msType": 1,
"portal": "112.126.80.182:80",
"mcuDelay": 3000,
"MCUServerIP": "123.56.73.119",
"MCUServerPort": "7001",
"maxVideoChannels": 1,
"maxAudioChannels": 1,
"maxMediaChannels": 2
}*/
};
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="3">paramInfo</td>
<td rowspan="3"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>userName:(必选)String </p>进入课堂的名字</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>password:(可选)String </p>进入课堂的密码,如果课堂不设置密码就不需要,设置了密码的情况下,进入课堂需要输入密码,根据初始化回调的参数passwordRequired来判断</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">onSuccess</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>成功回调函数</p>
</td>
</tr>
</tbody>
</table></div>
### 离开会议 ###
#### client.leaveClass() ####
离开会议
### 获取当前的状态 ###
#### client.mcuClientStatus() ####
获取当前的状态
示例代码
var callbackData=client.mcuClientStatus();
//返回一个对象
//{code:0,message:"XXXXXX"}
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">callbackData</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<tr class="row-odd">
<td>
<ul>
<li>code:Number </p></li>
0 //SDK 未初始化</p>
1 //未加入会议</p>
2 //已经加入会议</p>
3 //已经离开会议</p>
4 //未知状态
</ul>
</td>
</tr>
<td>
<ul>
<li>message:String </p>
状态的描述,对应code,默认为空</li>
</ul>
</td>
</tr>
</tbody>
</table></div>
### 发送消息 ###
#### client.sendChatMsg(paramInfo) ####
发送聊天消息
示例代码
var paramInfo={
"message":"需要发送的内容",
"to":0
};
client.sendChatMsg(paramInfo);
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="M">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">paramInfo</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<tr class="row-odd">
<td>
<ul>
<li>message:(必选)String </p>消息内容</li>
</ul>
</td>
</tr>
<td>
<ul>
<li>to:(可选) Number </p>
接收消息的人的ID,默认值是0(所有人都)</li>
</ul>
</td>
</tr>
</tbody>
</table></div>
----------
## <font color=blue>McuClient 回调事件 </font>##
### 会议日志信息 事件回调 ###
示例代码
client.on(MessageTypes.CLASS_SHOW_DETAIL, function(callbackData){
//返回值
/*{
"repeatmonthweekweek": 0,
"endmode": 0,
"repeatweek": "",
"endcount": 1,
"errorCode": 0,
"cycle": 0,
"repeatmonthday": 0,
"frequency": 1,
"repeatday": 0,
"meetingName": "mcuClient",
"repeatmode": 0,
"finalenddate": "",
"meetingContent": "",
"beginTime": "2017-01-16 13:00:00",
"endTime": "2017-01-31 15:00:00",
"monthType": 0,
"category": "",
"repeatmonthweekday": 0,
"status": 1
}*/
});
### 会议有人加入 事件回调 ###
示例代码
client.on(MessageTypes.CLASS_INSERT_ROSTER,function(callbackData){
//返回值
/*{
"nodeId": 1483947664,
"nodeData": {
"nodeId": 1483947664,
"name": "cccccc",
"role": 1,
"level": 0,
"audioRecords": [],
"videoRecords": [],
"status": null,
"userData": {
"qq": "",
"skype": "",
"mobile": ""
},
"userId": "0",
"handUpTime": null,
"deviceType": 3,
"mobileDirection": null
}
}*/
});
### 会议有人离开 事件回调 ###
示例代码
client.on(MessageTypes.CLASS_DELETE_ROSTER,function(callbackData){
//{"nodeId":1234}
});
### 关闭会议 事件回调 ###
示例代码
client.on(MessageTypes.CLASS_EXIT, function(callbackData){
//.....
});
### 收到聊天消息 事件回调 ###
示例代码
client.on(MessageTypes.CHAT_RECEIVE, function(callbackData){
//返回值
/*{
"fromNodeID": 1484207995,
"toNodeID": 0,
"message": "消息内容",
"fromName": "发送消息人的名字",
"fromRole": 0
}*/
});
### 视频显示 事件回调 ###
示例代码
client.on(MessageTypes.VIDEO_RECEIVE, function(callbackData){
//.....
});
### 文档 事件回调 ###
示例代码
client.on(MessageTypes.DOC_SHOW, function(callbackData){
//.....
});
### 文档笔记 事件回调 ###
示例代码
client.on(MessageTypes.DOC_ANNOTATION,function(callbackData){
//.....
});
### 删除文档 事件回调 ###
示例代码
client.on(MessageTypes.DOC_DELETE,function(callbackData){
//.....
});
----------
## <font color=blue>ErrorCode 错误码查询</font> ##
<div class="wy-table-responsive">
<table border="1" class="docutils">
<colgroup>
<col width="14%">
<col width="10%">
<col width="76%">
</colgroup>
<tbody valign="M">
<tr class="row-odd">
<td><p class="first last">错误代码</p></td>
<td><p class="first last">值(code)</p></td>
<td><p class="first last">描述(reson)</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_PAEAM</td>
<td>100</td>
<td><p class="first last">初始化参数错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_NETWORK</td>
<td>101</td>
<td><p class="first last">初始化网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_PROTOCOL</td>
<td>102</td>
<td><p class="first last">初始化协议错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_FAILED</td>
<td>103</td>
<td><p class="first last">初始化验证失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_NETWORK</td>
<td>200</td>
<td><p class="first last">加入会议网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_PROTOCOL</td>
<td>201</td>
<td><p class="first last">加入会议化协议错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_FAILED</td>
<td>202</td>
<td><p class="first last">加入会议化异常错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_PARAM</td>
<td>203</td>
<td><p class="first last">加入会议参数错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_FULL</td>
<td>204</td>
<td><p class="first last">人数已满</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_MD5_WRONG</td>
<td>205</td>
<td><p class="first last">MD5验证失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_PASSWORD_WRONG</td>
<td>206</td>
<td><p class="first last">密码错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_CONFILICT</td>
<td>207</td>
<td><p class="first last">已经在其它地方登陆</p></td>
</tr>
<tr class="row-even">
<td>ERR_GET_CLASS_DETAIL</td>
<td>300</td>
<td><p class="first last">获取classDetail失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_GET_MEETING_PARAML</td>
<td>301</td>
<td><p class="first last">获取MeetingParam失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_NETWORK</td>
<td>10000</td>
<td><p class="first last">网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_UNKNOWN</td>
<td>10001</td>
<td><p class="first last">未知错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_SOCKET_DISCONNECT</td>
<td>20000</td>
<td><p class="first last">MCU断开连接,已经离开会议</p></td>
</tr>
</tbody>
</table>
</div>
\ No newline at end of file
不能预览此文件类型
# McuClient API参考说明 #
</p>
----------
##<font color=blue>McuClient 目录</font> ##
> - **创建McuClient对象**
>
> - **McuClient接口**
>
> - **McuClient回调事件**
>
> - **ErrorCode 错误码查询**
----------
##<font color=blue>使用步骤说明</font> ##
> 1. 创建McuClient对象
> 2. McuClient初始化init
> 3. 添加MessageTypes中的事件监听(接收各个模块的消息)
> 3. McuClient加入会议
> 4. 加入会议成功之后可以调用其他接口和监听事件
----------
##<font color=blue>创建McuClient对象</font> ##
只创建一次
示例代码
window.onload=function(){
//创建client,这是必须的第一步
const client=MCUClientEngine.createMcuClient();
//获取事件监听消息定义
const MessageTypes=MCUClientEngine.MessageTypes;
}
----------
## <font color=blue>McuClient接口 </font>##
### 初始化 ###
#### client.init (paramInfo,onSuccess,mcuErrorEventHandler) ####
client创建完成之后第一步需要初始化。
示例代码
var paramInfo={
"meetingNumber":123456,
"portal":"127.0.0.1:80",
"usertRole":"normal",
"userID":0,
};
//初始化
client.init(paramInfo,onSuccess,mcuErrorEventHandler);
function onSuccess(callbackData){
//初始化成功回调
/*{
"siteId": "h5test",
"passwordRequired": true,
"md5": "de399d5540b3da2fbc1eb0a770d4fd66",
"code": 0,
"msType": 1
}*/
};
function mcuErrorEventHandler(callbackData){
//整个MCUClient中Error异常监听
//返回值callbackData的结构为{"code":errorCode,"reson":""}
//errorCode的列表在文档最后面的 ErrorCode错误码查询
};
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="mid">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="5">paramInfo</td>
<td rowspan="5"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>meetingNumber:(必选)Number </p>课堂号</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>portal:(必选)String </p>IP地址</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>usertRole:(可选) String </p>
用户的身份,5种类型,默认是normal
;host(主持人/老师)、presenter(主讲人)、assistant(助教)、normal(普通角色/学生),record(暂时没用)</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>userId:(可选) String </p>
第三方用户id,默认是0
</ul>
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">onSuccess</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>初始化成功回调函数,返回值:</p>{"siteId":"h5test","passwordRequired":true,"md5":"de399d5540b3da2fbc1eb0a770d4fd66","code":0,"msType":1}
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">mcuErrorEventHandler</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>整个MCUClient中Error异常监听</p></td>
</tr>
</tbody>
</table></div>
### 加入会议 ###
#### client.joinClass (paramInfo,onSuccess) ####
client初始化成功之后,加入会议。
示例代码
var paramInfo={
"userName":"大名",//自己的名字,在列表中显示
"password":"123321",//课堂密码,如果设置了密码需要验证
};
//加入会议
client.joinClass(paramInfo,onSuccess);
function onSuccess(callbackData){
//加入会议成功回调
/*{
"siteId": "h5test",
"confId": 1292388778,
"h5Module": 0,
"nodeId": 1484789938,
"topNodeID": 101,
"userRole": "normal",
"role": 1,
"isHost": false,
"classRole": 0,
"userId": "0",
"userName": "cccccc",
"password": "222222",
"userType": 8,
"passwordRequired": true,
"md5": "b36da144521b70d89e72993cd1117b5b",
"msType": 1,
"portal": "112.126.80.182:80",
"mcuDelay": 3000,
"MCUServerIP": "123.56.73.119",
"MCUServerPort": "7001",
"maxVideoChannels": 1,
"maxAudioChannels": 1,
"maxMediaChannels": 2
}*/
};
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="3">paramInfo</td>
<td rowspan="3"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>userName:(必选)String </p>进入课堂的名字</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>password:(可选)String </p>进入课堂的密码,如果课堂不设置密码就不需要,设置了密码的情况下,进入课堂需要输入密码,根据初始化回调的参数passwordRequired来判断</li>
</ul>
</td>
</tr>
<tr class="row-odd">
<td><p class="first last">onSuccess</p></td>
<td><p class="first last">Function</p></td>
<td><p class="first last"><li>(必选) Function </p>成功回调函数</p>
</td>
</tr>
</tbody>
</table></div>
### 离开会议 ###
#### client.leaveClass() ####
离开会议
### 获取当前的状态 ###
#### client.mcuClientStatus() ####
获取当前的状态
示例代码
var callbackData=client.mcuClientStatus();
//返回一个对象
//{code:0,message:"XXXXXX"}
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">callbackData</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<tr class="row-odd">
<td>
<ul>
<li>code:Number </p></li>
0 //SDK 未初始化</p>
1 //未加入会议</p>
2 //已经加入会议</p>
3 //已经离开会议</p>
4 //未知状态
</ul>
</td>
</tr>
<td>
<ul>
<li>message:String </p>
状态的描述,对应code,默认为空</li>
</ul>
</td>
</tr>
</tbody>
</table></div>
### 发送消息 ###
#### client.sendChatMsg(paramInfo) ####
发送聊天消息
示例代码
var paramInfo={
"message":"需要发送的内容",
"to":0
};
client.sendChatMsg(paramInfo);
<div class="wy-table-responsive"><table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="M">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">paramInfo</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<tr class="row-odd">
<td>
<ul>
<li>message:(必选)String </p>消息内容</li>
</ul>
</td>
</tr>
<td>
<ul>
<li>to:(可选) Number </p>
接收消息的人的ID,默认值是0(所有人都)</li>
</ul>
</td>
</tr>
</tbody>
</table></div>
### 添加白板内容 ###
#### client.sendInsertAnnotaion(paramInfo) ####
添加白板内容,可以添加任意线段、直线、矩形、圆形、文本等等内容。下面的代码中将分别演示添加(任意线段、直线、矩形、圆形、文本)内容时调用接口所要传入的参数。
示例代码
1. 添加线段(不规则);
var paramInfo={
"type": 0,
"pointGroup": [{"w":10,"h":20},{"w":11,"h":21},{"w":12,"h":22}],//有多个坐标点组成
"color": "#000000",
"thickness": 1
};
client.sendInsertAnnotaion(paramInfo);
2. 添加直线;
var paramInfo={
"type": 1,
"pointGroup": [{"w":10,"h":20},{"w":60,"h":70}],//只有两个坐标点 [起点,终点]
"color": "#000000",
"thickness": 1
};
client.sendInsertAnnotaion(paramInfo);
3. 添加矩形;
var paramInfo={
"type": 2,
"pointGroup": [{"w":10,"h":10},{"w":60,"h":60}],//矩形对角线 [对角线坐标点1,对角线坐标点2]
"color": "#000000",
"thickness": 1
};
client.sendInsertAnnotaion(paramInfo);
4. 添加圆形;
var paramInfo={
"type": 3,
"pointGroup": [{"w":50,"h":50}],//只有一个坐标点[圆的中心坐标]
"color": "#000000",
"thickness": 1,
"radius": 20
};
client.sendInsertAnnotaion(paramInfo);
5. 添加文本;
var paramInfo={
"type": 4,
"pointGroup": [{"w":10,"h":20}],//只有一个坐标点[文本的左上角坐标]
"color": "#000000",
"fontSize": 14,
"fontName": "",
"text":"文本的内容"
};
client.sendInsertAnnotaion(paramInfo);
<div class="wy-table-responsive">
<table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">paramInfo</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<tr class="row-odd">
<td>
<ul>
<li>type:(必选)Number</p></li>
0 (线段), 1 (直线), 2(矩形), 3(圆形), 4(文本)
</ul>
</td>
</tr>
<td>
<ul>
<li>pointGroup:(必选)array[{"w":w,"h":h}] </p>
画布上的坐标点对象集合数组,数组中坐标点对象的数量根据type的类型而定,上面有示例代码</li>
</ul>
</td>
</tr>
</tr>
<td>
<ul>
<li>text:(文本必选)String </p>
文本的内容,这个属性只有在type类型为文本的时候使用,其它类型的情况下不使用</li>
</ul>
</td>
</tr>
</tr>
<td>
<ul>
<li>radius:(绘制圆形必选)Number </p>
圆的半径(按画布宽度百分比计算),这个只在绘制圆的时候使用,其他type的时候不使用,这个值是一个相对画布宽度大小的百分比,比如在画布宽度为400,要绘制一个半径为40的圆,计算的百分比值=40/400=10%,那么radius=10</li>
</ul>
</td>
</tr>
</tr>
<td>
<ul>
<li>color:(可选)String </p>
颜色值,默认为"#000000"</li>
</ul>
</td>
</tr>
</tr>
<td>
<ul>
<li>thickness:(可选)Number </p>
线条的粗细度,除了文本之外的图像都有线条粗细,默认值为1</li>
</ul>
</td>
</tr>
</tr>
<td>
<ul>
<li>fontSize:(可选)Number </p>
文本的字体大小,默认值为14,这个属性只有在type类型为文本的时候使用,其它类型的情况下不使用</li>
</ul>
</td>
</tr>
</tr>
<td>
<ul>
<li>fontName:(可选)String </p>
文本字体,默认值为null,这个属性只有在type类型为文本的时候使用,其它类型的情况下不使用</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
### 删除指定白板内容 ###
#### client.sendDeleteAnnotaion(paramInfo) ####
删除已有的白板内容,每一次插入的白板内容都有一个唯一的itemIdx标识,需要删除指定的白板内容,参数传递itemIdx即可。
示例代码
//下列代码为删除itemIdx标识为12222的白板内容
var paramInfo={
"itemIdx": 12222
};
client.sendDeleteAnnotaion(paramInfo);
<div class="wy-table-responsive">
<table border="1" class="docutils">
<colgroup>
<col width="10%">
<col width="10%">
<col width="80%">
</colgroup>
<tbody valign="m">
<tr class="row-odd">
<td><p class="first last">参数名称</p></td>
<td><p class="first last">类型</p></td>
<td><p class="first last">该对象包含以下属性</p></td>
</tr>
<tr class="row-even">
<td rowspan="11">paramInfo</td>
<td rowspan="11"><p class="first last">对象</p></td>
</tr>
<tr class="row-odd">
<td>
<ul>
<li>itemIdx:(必选)Number</p></li>
白板内容的itemIdx标识,需要删除指定的白板内容,参数传递itemIdx即可。
</ul>
</td>
</tbody>
</table>
</div>
----------
## <font color=blue>McuClient 回调事件 </font>##
### 会议日志信息 事件回调 ###
示例代码
client.on(MessageTypes.CLASS_SHOW_DETAIL, function(callbackData){
//返回值
/*{
"repeatmonthweekweek": 0,
"endmode": 0,
"repeatweek": "",
"endcount": 1,
"errorCode": 0,
"cycle": 0,
"repeatmonthday": 0,
"frequency": 1,
"repeatday": 0,
"meetingName": "mcuClient",
"repeatmode": 0,
"finalenddate": "",
"meetingContent": "",
"beginTime": "2017-01-16 13:00:00",
"endTime": "2017-01-31 15:00:00",
"monthType": 0,
"category": "",
"repeatmonthweekday": 0,
"status": 1
}*/
});
### 会议有人加入事件回调 ###
示例代码
client.on(MessageTypes.CLASS_INSERT_ROSTER,function(callbackData){
//返回值
/*{
"nodeId": 1483947664,
"nodeData": {
"nodeId": 1483947664,
"name": "cccccc",
"role": 1,
"level": 0,
"audioRecords": [],
"videoRecords": [],
"status": null,
"userData": {
"qq": "",
"skype": "",
"mobile": ""
},
"userId": "0",
"handUpTime": null,
"deviceType": 3,
"mobileDirection": null
}
}*/
});
### 会议有人离开 事件回调 ###
示例代码
client.on(MessageTypes.CLASS_DELETE_ROSTER,function(callbackData){
//{"nodeId":1234}
});
### 关闭会议 事件回调 ###
示例代码
client.on(MessageTypes.CLASS_EXIT, function(callbackData){
//.....
});
### 收到聊天消息 事件回调 ###
示例代码
client.on(MessageTypes.CHAT_RECEIVE, function(callbackData){
//返回值
/*{
"fromNodeID": 1484207995,
"toNodeID": 0,
"message": "消息内容",
"fromName": "发送消息人的名字",
"fromRole": 0
}*/
});
### 白板插入内容 事件回调 ###
示例代码
client.on(MessageTypes.WHITEBOARD_ANNOTAION_INSERT, function(callbackData){
//.....
});
### 白板删除内容 事件回调 ###
示例代码
client.on(MessageTypes.WHITEBOARD_ANNOTAION_DELETE, function(callbackData){
//.....
});
### 视频显示 事件回调 ###
示例代码
client.on(MessageTypes.VIDEO_RECEIVE, function(callbackData){
//.....
});
### 文档 事件回调 ###
示例代码
client.on(MessageTypes.DOC_SHOW, function(callbackData){
//.....
});
### 文档笔记 事件回调 ###
示例代码
client.on(MessageTypes.DOC_ANNOTATION,function(callbackData){
//.....
});
### 删除文档 事件回调 ###
示例代码
client.on(MessageTypes.DOC_DEL,function(callbackData){
//.....
});
----------
## <font color=blue>ErrorCode 错误码查询</font> ##
<div class="wy-table-responsive">
<table border="1" class="docutils">
<colgroup>
<col width="14%">
<col width="10%">
<col width="76%">
</colgroup>
<tbody valign="M">
<tr class="row-odd">
<td><p class="first last">错误代码</p></td>
<td><p class="first last">值(code)</p></td>
<td><p class="first last">描述(reson)</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_PAEAM</td>
<td>100</td>
<td><p class="first last">初始化参数错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_NETWORK</td>
<td>101</td>
<td><p class="first last">初始化网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_PROTOCOL</td>
<td>102</td>
<td><p class="first last">初始化协议错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_INIT_FAILED</td>
<td>103</td>
<td><p class="first last">初始化验证失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_NETWORK</td>
<td>200</td>
<td><p class="first last">加入会议网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_PROTOCOL</td>
<td>201</td>
<td><p class="first last">加入会议化协议错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_FAILED</td>
<td>202</td>
<td><p class="first last">加入会议化异常错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_PARAM</td>
<td>203</td>
<td><p class="first last">加入会议参数错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_FULL</td>
<td>204</td>
<td><p class="first last">人数已满</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_MD5_WRONG</td>
<td>205</td>
<td><p class="first last">MD5验证失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_PASSWORD_WRONG</td>
<td>206</td>
<td><p class="first last">密码错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_CLASS_JOIN_CONFILICT</td>
<td>207</td>
<td><p class="first last">已经在其它地方登陆</p></td>
</tr>
<tr class="row-even">
<td>ERR_GET_CLASS_DETAIL</td>
<td>300</td>
<td><p class="first last">获取classDetail失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_GET_MEETING_PARAML</td>
<td>301</td>
<td><p class="first last">获取MeetingParam失败</p></td>
</tr>
<tr class="row-even">
<td>ERR_NETWORK</td>
<td>10000</td>
<td><p class="first last">网络错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_UNKNOWN</td>
<td>10001</td>
<td><p class="first last">未知错误</p></td>
</tr>
<tr class="row-even">
<td>ERR_SOCKET_DISCONNECT</td>
<td>20000</td>
<td><p class="first last">MCU断开连接,已经离开会议</p></td>
</tr>
</tbody>
</table>
</div>
\ No newline at end of file
不能预览此文件类型
# DOCS FOLDER
wrcp 主要负责和MCU服务端通讯部分的
1.协议上 senddata是顶层协议壳。所有消息包都嵌套打在 这个 pdu中
2.
从会议流程上看,分以下几类:
1、connectprovider(内部嵌套joinconference包):加入会议协议,分为request和response两组。
2、joinsession(内部嵌套注册表的操作包):加入应用,分为request和response
3、joinchannel:加入channel
4、adapterpdu 中嵌套注册表操作pdu
mcu中的注册表是有客户端通过adapterpdu来维护的,mcu本身不维护这个数据
我特别强调这个,就是想说明,会议的所有控制逻辑不是mcu完成的,而是客户端完成的
3.每个应用就是一个session,(joinsession就是加入这个应用),客户端加入这个应用后,就能从mcu的注册标中活的这个应用的所有信息。
conference这个应用会保留会议的主要信息如用户列表等,而且很多会议控制我觉得也会在这个应用中。
然后特定应用如聊天就是负责聊天的数据转发,需要先joinsession然后在joinchannel(相当于聊天的数据通道),这样客户端会通过senddatapdu嵌套chatsenddatapdu来发送聊天channel的消息,其他客户端只要加入了聊天应用的聊天channel,就会收到聊天消息。
每个应用在joinsession时会嵌套adapterpdu,其中带上了需要维护的注册表信息(定义 registrykey和object)
注册表常用的就是 table,几乎所有app都维护了一个table
比如一个会议中会维护三个视频通道,这样在table中就会有三条记录(以视频channel id作为索引
所有用户加入视频应用后都会获得这个信息,且记录发生改变时会广播给全网用户。
具体到这个表格的存储呢,mcu仅仅知道 id 和 一个 pdu生成的字符串还有owner信息。具体这个记录的内容,mcu没有关心。
比如想定义一个会议的控制行为,很可能的操作就是:在conference这个应用的某个表格下插入一个特定id的string值。然后通过修改这个值,然后与会的人知道当前是什么行为
再比如,tabbar中的多个tab选项,每个选项对应一个id,其属性可以保存在conference中一个表中,这样属性值中可以有visble选项,老师切换时,将相关id属性同步成true,mcu会广播给所有客户端,这样所有的与会人员就知道切换tab了。
\ No newline at end of file