add result string for all return code
add get_mic_vol,set_mic_vol
正在显示
1 个修改的文件
包含
144 行增加
和
0 行删除
| @@ -175,6 +175,119 @@ a:active { | @@ -175,6 +175,119 @@ a:active { | ||
| 175 | initialize(); | 175 | initialize(); |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | + var wsResult = [ | ||
| 179 | + "MOV_START_SUC", | ||
| 180 | + "MOV_START_FAIL", | ||
| 181 | + "MOV_STOP_SUC", | ||
| 182 | + "MOV_STOP_FAIL", | ||
| 183 | + "MOV_PAUSE_SUC", | ||
| 184 | + "MOV_PAUSE_FAIL", | ||
| 185 | + "MOV_RESUME_SUC", | ||
| 186 | + "MOV_RESUME_FAIL", | ||
| 187 | + "MOV_SEEK_SUC", | ||
| 188 | + "MOV_SEEK_FAIL", | ||
| 189 | + "MOV_PROPERTY", | ||
| 190 | + "SS_START_SUC", | ||
| 191 | + "SS_START_FAIL", | ||
| 192 | + "SS_STOP_SUC", | ||
| 193 | + "SS_STOP_FAIL", | ||
| 194 | + "REC_START_SUC", | ||
| 195 | + "REC_START_FAIL", | ||
| 196 | + "REC_STOP_SUC", | ||
| 197 | + "REC_STOP_FAIL", | ||
| 198 | + "REC_PAUSE_SUC", | ||
| 199 | + "REC_PAUSE_FAIL", | ||
| 200 | + "REC_RESUME_SUC", | ||
| 201 | + "REC_RESUME_FAIL", | ||
| 202 | + "MOV_PLAY_FINISH", | ||
| 203 | + "MOV_VERSION", | ||
| 204 | + "SS_VERSION", | ||
| 205 | + "REC_VERSION", | ||
| 206 | + "MOV_SELECT_FILE_CANCEL", | ||
| 207 | + "QAV_LOGIN_SUC", | ||
| 208 | + "QAV_LOGIN_FAIL", | ||
| 209 | + "QAV_LOGOUT_SUC", | ||
| 210 | + "QAV_LOGOUT_FAIL", | ||
| 211 | + "QAV_ENTERROOM_SUC", | ||
| 212 | + "QAV_ENTERROOM_FAIL", | ||
| 213 | + "QAV_LEAVEROOM_SUC", | ||
| 214 | + "QAV_LEAVEROOM_FAIL", | ||
| 215 | + "QAV_OPEN_MIC_SUC", | ||
| 216 | + "QAV_OPEN_MIC_FAIL", | ||
| 217 | + "QAV_OPEN_MIC_NODEV", | ||
| 218 | + "QAV_CLOSE_MIC_SUC", | ||
| 219 | + "QAV_CLOSE_MIC_FAIL", | ||
| 220 | + "QAV_CLOSE_MIC_NODEV", | ||
| 221 | + "QAV_OPEN_PLAYER_SUC", | ||
| 222 | + "QAV_OPEN_PLAYER_FAIL", | ||
| 223 | + "QAV_OPEN_PLAYER_NODEV", | ||
| 224 | + "QAV_CLOSE_PLAYER_SUC", | ||
| 225 | + "QAV_CLOSE_PLAYER_FAIL", | ||
| 226 | + "QAV_CLOSE_PLAYER_NODEV", | ||
| 227 | + "QAV_MUTE_AUDIO_SUC", | ||
| 228 | + "QAV_MUTE_AUDIO_FAIL", | ||
| 229 | + "QAV_UNMUTE_AUDIO_SUC", | ||
| 230 | + "QAV_UNMUTE_AUDIO_FAIL", | ||
| 231 | + "REC_SAVE_FILE_CANCEL", | ||
| 232 | + "GET_MIC_SUC", | ||
| 233 | + "GET_MIC_FAIL", | ||
| 234 | + "DS_START_SUC", | ||
| 235 | + "DS_START_FAIL", | ||
| 236 | + "DS_STOP_SUC", | ||
| 237 | + "DS_STOP_FAIL", | ||
| 238 | + "AUD_START_SUC", | ||
| 239 | + "AUD_START_FAIL", | ||
| 240 | + "AUD_STOP_SUC", | ||
| 241 | + "AUD_STOP_FAIL", | ||
| 242 | + "AUD_DATA", | ||
| 243 | + "SS_DATA", | ||
| 244 | + "MOV_DATA", | ||
| 245 | + "PEN_START_SUC", | ||
| 246 | + "PEN_START_FAIL", | ||
| 247 | + "PEN_STOP_SUC", | ||
| 248 | + "PEN_STOP_FAIL", | ||
| 249 | + "PEN_VERSION", | ||
| 250 | + "QAV_DEVICE_SUC", | ||
| 251 | + "QAV_DEVICE_FAIL", | ||
| 252 | + "CBD_QUERY_SUC", | ||
| 253 | + "CBD_QUERY_FAIL", | ||
| 254 | + "CBD_GET_SUC", | ||
| 255 | + "CBD_GET_FAIL", | ||
| 256 | + "FILE_GET_SUC", | ||
| 257 | + "FILE_GET_FAIL", | ||
| 258 | + "FILE_SET_SUC", | ||
| 259 | + "FILE_SET_FAIL", | ||
| 260 | + "RESTART_SUC", | ||
| 261 | + "RESTART_FAIL", | ||
| 262 | + "GET_CAM_SUC", | ||
| 263 | + "GET_CAM_FAIL", | ||
| 264 | + "CAM_START_SUC", | ||
| 265 | + "CAM_START_FAIL", | ||
| 266 | + "CAM_STOP_SUC", | ||
| 267 | + "CAM_STOP_FAIL", | ||
| 268 | + "SWITCH_SCENE_SUC", | ||
| 269 | + "SWITCH_SCENE_FAIL", | ||
| 270 | + "PUSH_STREAM_FAIL", | ||
| 271 | + "SHOW_UI_SUC", | ||
| 272 | + "SET_VIDEO_PARAM_SUC", | ||
| 273 | + "SET_VIDEO_PARAM_FAIL", | ||
| 274 | + "GET_VIDEO_PARAM_SUC", | ||
| 275 | + "GET_VIDEO_PARAM_FAIL", | ||
| 276 | + "START_RECORD_SUC", | ||
| 277 | + "START_RECORD_FAIL", | ||
| 278 | + "STOP_RECORD_SUC", | ||
| 279 | + "STOP_RECORD_FAIL", | ||
| 280 | + "START_PUSH_SUC", | ||
| 281 | + "START_PUSH_FAIL", | ||
| 282 | + "STOP_PUSH_SUC", | ||
| 283 | + "STOP_PUSH_FAIL", | ||
| 284 | + "GET_RTMP_PORT_SUC", | ||
| 285 | + "GET_RTMP_PORT_FAIL", | ||
| 286 | + "SET_MIC_VOL_SUC", | ||
| 287 | + "SET_MIC_VOL_FAIL", | ||
| 288 | + "GET_MIC_VOL_SUC", | ||
| 289 | + "GET_MIC_VOL_FAIL"]; | ||
| 290 | + | ||
| 178 | function onMessage(evt) | 291 | function onMessage(evt) |
| 179 | { | 292 | { |
| 180 | if(typeof(evt.data)=="string"){ | 293 | if(typeof(evt.data)=="string"){ |
| @@ -191,6 +304,14 @@ a:active { | @@ -191,6 +304,14 @@ a:active { | ||
| 191 | var byte_order = dv.getUint8(2, true); | 304 | var byte_order = dv.getUint8(2, true); |
| 192 | var data_len = dv.getUint32(4, true); | 305 | var data_len = dv.getUint32(4, true); |
| 193 | 306 | ||
| 307 | + if( result >= 0 && result < wsResult.length ){ | ||
| 308 | + var resultString = wsResult[result]; | ||
| 309 | + writeToScreen('<span style="color: blue;">result: ' + resultString + ' </span>'); | ||
| 310 | + } | ||
| 311 | + else{ | ||
| 312 | + writeToScreen('<span style="color: blue;">result: unknown result </span>'); | ||
| 313 | + } | ||
| 314 | + | ||
| 194 | if(0 == result){//mov_start success | 315 | if(0 == result){//mov_start success |
| 195 | playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/ms"); | 316 | playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/ms"); |
| 196 | } | 317 | } |
| @@ -263,6 +384,14 @@ a:active { | @@ -263,6 +384,14 @@ a:active { | ||
| 263 | rtmp_port = data_sting; | 384 | rtmp_port = data_sting; |
| 264 | writeToScreen('<span style="color: blue;">get_rtmp_port result: ' + data_sting + ' </span>'); | 385 | writeToScreen('<span style="color: blue;">get_rtmp_port result: ' + data_sting + ' </span>'); |
| 265 | } | 386 | } |
| 387 | + else if(109 == result){//get_mic_vol success | ||
| 388 | + var data = new Uint8Array(evt.target.result, 8, evt.target.result.byteLength - 8 -1); | ||
| 389 | + //var data_sting = new TextDecoder("utf-8").decode(data); | ||
| 390 | + var data_sting = utf8to16(data); | ||
| 391 | + var input = document.getElementById('mic_vol'); | ||
| 392 | + input.value = data_sting; | ||
| 393 | + writeToScreen('<span style="color: blue;">get_rtmp_port result: ' + data_sting + ' </span>'); | ||
| 394 | + } | ||
| 266 | else{ | 395 | else{ |
| 267 | var data = new Uint8Array(evt.target.result, 8, evt.target.result.byteLength - 8); | 396 | var data = new Uint8Array(evt.target.result, 8, evt.target.result.byteLength - 8); |
| 268 | //var data_sting = new TextDecoder("utf-8").decode(data); | 397 | //var data_sting = new TextDecoder("utf-8").decode(data); |
| @@ -465,6 +594,15 @@ a:active { | @@ -465,6 +594,15 @@ a:active { | ||
| 465 | else if(obj.id == "get_rtmp_port"){ | 594 | else if(obj.id == "get_rtmp_port"){ |
| 466 | cmd.type = 52; | 595 | cmd.type = 52; |
| 467 | } | 596 | } |
| 597 | + else if(obj.id == "set_mic_vol"){ | ||
| 598 | + cmd.type = 53; | ||
| 599 | + var param = document.getElementById("mic_vol"); | ||
| 600 | + cmd.data = utf16to8(param.value); | ||
| 601 | + cmd.data_len = cmd.data.length; | ||
| 602 | + } | ||
| 603 | + else if(obj.id == "get_mic_vol"){ | ||
| 604 | + cmd.type = 54; | ||
| 605 | + } | ||
| 468 | 606 | ||
| 469 | doSendWSCmd(cmd); | 607 | doSendWSCmd(cmd); |
| 470 | } | 608 | } |
| @@ -732,6 +870,12 @@ a:active { | @@ -732,6 +870,12 @@ a:active { | ||
| 732 | </tr> | 870 | </tr> |
| 733 | <tr> | 871 | <tr> |
| 734 | <td width="35" colspan="2"><img src="images/spacer.gif" width="20" height="10" /></td> | 872 | <td width="35" colspan="2"><img src="images/spacer.gif" width="20" height="10" /></td> |
| 873 | + <td colspan="3"><button type="button" id="get_mic_vol" onclick="javascript:onTestClick(this);">get_mic_vol</button></td> | ||
| 874 | + <td colspan="3"><input id="mic_vol" width="400"/></td> | ||
| 875 | + <td colspan="3"><button type="button" id="set_mic_vol" onclick="javascript:onTestClick(this);">set_mic_vol</button></td> | ||
| 876 | + </tr> | ||
| 877 | + <tr> | ||
| 878 | + <td width="35" colspan="2"><img src="images/spacer.gif" width="20" height="10" /></td> | ||
| 735 | <td colspan="3"><button type="button" id="aud_start" onclick="javascript:onTestClick(this);">aud_start</button></td> | 879 | <td colspan="3"><button type="button" id="aud_start" onclick="javascript:onTestClick(this);">aud_start</button></td> |
| 736 | <td colspan="3"></td> | 880 | <td colspan="3"></td> |
| 737 | <td colspan="3"><button type="button" id="aud_stop" onclick="javascript:onTestClick(this);">aud_stop</button></td> | 881 | <td colspan="3"><button type="button" id="aud_stop" onclick="javascript:onTestClick(this);">aud_stop</button></td> |
-
请 注册 或 登录 后发表评论