胡斌

parse the result of rtmp status notifation

正在显示 1 个修改的文件 包含 19 行增加22 行删除
@@ -278,7 +278,11 @@ a:active { @@ -278,7 +278,11 @@ a:active {
278 "SET_MIC_VOL_SUC", 278 "SET_MIC_VOL_SUC",
279 "SET_MIC_VOL_FAIL", 279 "SET_MIC_VOL_FAIL",
280 "GET_MIC_VOL_SUC", 280 "GET_MIC_VOL_SUC",
281 - "GET_MIC_VOL_FAIL"]; 281 + "GET_MIC_VOL_FAIL",
  282 + "RTMP_CONNECTING",
  283 + "RTMP_CONNECT_SUC",
  284 + "RTMP_CONNECT_FAIL",
  285 + "RTMP_CONNECT_CLOSED"];
282 286
283 function onMessage(evt) 287 function onMessage(evt)
284 { 288 {
@@ -331,6 +335,9 @@ a:active { @@ -331,6 +335,9 @@ a:active {
331 else if(55 == result){//ds_start success 335 else if(55 == result){//ds_start success
332 playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/ds"); 336 playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/ds");
333 } 337 }
  338 + else if(59 == result){//as start success
  339 + playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/as");
  340 + }
334 else if(result == 83){//get camera sucess 341 else if(result == 83){//get camera sucess
335 if(data_len > 4){ 342 if(data_len > 4){
336 var cam_num = dv.getUint32(8, true); 343 var cam_num = dv.getUint32(8, true);
@@ -402,11 +409,16 @@ a:active { @@ -402,11 +409,16 @@ a:active {
402 input.value = data_sting; 409 input.value = data_sting;
403 writeToScreen('<span style="color: blue;">get_rtmp_port result: ' + data_sting + ' </span>'); 410 writeToScreen('<span style="color: blue;">get_rtmp_port result: ' + data_sting + ' </span>');
404 } 411 }
  412 + else if(111 <=result && 114>= result){
  413 + var data = new Uint8Array(evt.target.result, 8, evt.target.result.byteLength - 8);
  414 + var url = utf8to16(data);
  415 + writeToScreen('<span style="color: blue;">url: ' + url + ' </span>');
  416 + }
405 else{ 417 else{
406 var data = new Uint8Array(evt.target.result, 8, evt.target.result.byteLength - 8); 418 var data = new Uint8Array(evt.target.result, 8, evt.target.result.byteLength - 8);
407 //var data_sting = new TextDecoder("utf-8").decode(data); 419 //var data_sting = new TextDecoder("utf-8").decode(data);
408 var data_sting = utf8to16(data); 420 var data_sting = utf8to16(data);
409 - writeToScreen('<span style="color: blue;">RESPONSE: ' + data_sting + ' </span>'); 421 + writeToScreen('<span style="color: blue;">url: ' + data_sting + ' </span>');
410 } 422 }
411 } 423 }
412 } 424 }
@@ -702,6 +714,9 @@ function getExplorerTitle() { @@ -702,6 +714,9 @@ function getExplorerTitle() {
702 714
703 var default_ss_start_pos = "0,0," + window.screen.width + "," + window.screen.height; 715 var default_ss_start_pos = "0,0," + window.screen.width + "," + window.screen.height;
704 document.getElementById('ds_start_coord').value = default_ss_start_pos; 716 document.getElementById('ds_start_coord').value = default_ss_start_pos;
  717 + //video=scr,doc,mov,non ; audio=mic,mov,non
  718 + document.getElementById('start_push_input').value = "0 video=scr audio=mic rtmp://127.0.0.1/live/1";
  719 + document.getElementById('start_record_input').value = "0 video=scr audio=mic";
705 } 720 }
706 721
707 function onJavaScriptBridgeCreated(id){ 722 function onJavaScriptBridgeCreated(id){
@@ -805,31 +820,13 @@ function getExplorerTitle() { @@ -805,31 +820,13 @@ function getExplorerTitle() {
805 initialize(); 820 initialize();
806 } 821 }
807 822
808 - function checkbox(type)  
809 - {  
810 - if(type=="vod")  
811 - {  
812 - if(document.getElementById('liveCheckbox').checked==true)  
813 - {  
814 - document.getElementById('liveCheckbox').checked=false;  
815 - }  
816 - }  
817 - if(type=="live")  
818 - {  
819 - if(document.getElementById('vodCheckbox').checked==true)  
820 - {  
821 - document.getElementById('vodCheckbox').checked=false;  
822 - }  
823 - }  
824 - }  
825 -  
826 function connectLiveServ() 823 function connectLiveServ()
827 { 824 {
828 var url = document.getElementById('websocketURL').value; 825 var url = document.getElementById('websocketURL').value;
829 826
830 if( wsState == "idle"){ 827 if( wsState == "idle"){
831 - wsState = "connecting";  
832 - writeToScreen("connecting " + url); 828 + wsState = "connecting";
  829 + writeToScreen("connecting " + url);
833 websocket = new WebSocket(url); 830 websocket = new WebSocket(url);
834 websocket.onopen = function(evt) { onOpen(evt) }; 831 websocket.onopen = function(evt) { onOpen(evt) };
835 websocket.onclose = function(evt) { onClose(evt) }; 832 websocket.onclose = function(evt) { onClose(evt) };