don't auto play the defult local streaming url,
just parse the input string of ss_start and start push to get the play url
正在显示
1 个修改的文件
包含
20 行增加
和
8 行删除
| @@ -167,6 +167,16 @@ a:active { | @@ -167,6 +167,16 @@ a:active { | ||
| 167 | initialize(); | 167 | initialize(); |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | + function checkAndPlayStream(inputstring){ | ||
| 171 | + var inputitem = inputstring.split(" "); | ||
| 172 | + for(var i=0; i < inputitem.length; i++ ){ | ||
| 173 | + if(inputitem[i].indexOf("rtmp://")>=0){ | ||
| 174 | + playRTMPStream(inputitem[i]); | ||
| 175 | + break; | ||
| 176 | + } | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + | ||
| 170 | var wsResult = [ | 180 | var wsResult = [ |
| 171 | "MOV_START_SUC", | 181 | "MOV_START_SUC", |
| 172 | "MOV_START_FAIL", | 182 | "MOV_START_FAIL", |
| @@ -309,7 +319,7 @@ a:active { | @@ -309,7 +319,7 @@ a:active { | ||
| 309 | } | 319 | } |
| 310 | 320 | ||
| 311 | if(0 == result || 6 == result || 8 == result){//mov_start,mov_pause,mov_seek success | 321 | if(0 == result || 6 == result || 8 == result){//mov_start,mov_pause,mov_seek success |
| 312 | - playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/ms"); | 322 | + //playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/ms"); |
| 313 | } | 323 | } |
| 314 | else if(10 == result){//movie property | 324 | else if(10 == result){//movie property |
| 315 | if(data_len > 7 * 4 + 8){ | 325 | if(data_len > 7 * 4 + 8){ |
| @@ -330,7 +340,7 @@ a:active { | @@ -330,7 +340,7 @@ a:active { | ||
| 330 | } | 340 | } |
| 331 | } | 341 | } |
| 332 | else if(11 == result){//ss_start success | 342 | else if(11 == result){//ss_start success |
| 333 | - playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/ss"); | 343 | + //playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/ss"); |
| 334 | } | 344 | } |
| 335 | else if(24 <= result && 26 >= result){ | 345 | else if(24 <= result && 26 >= result){ |
| 336 | if(data_len >= 4){ | 346 | if(data_len >= 4){ |
| @@ -340,10 +350,10 @@ a:active { | @@ -340,10 +350,10 @@ a:active { | ||
| 340 | } | 350 | } |
| 341 | } | 351 | } |
| 342 | else if(55 == result){//ds_start success | 352 | else if(55 == result){//ds_start success |
| 343 | - playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/ds"); | 353 | + //playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/ds"); |
| 344 | } | 354 | } |
| 345 | else if(59 == result){//as start success | 355 | else if(59 == result){//as start success |
| 346 | - playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/as"); | 356 | + //playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/as"); |
| 347 | } | 357 | } |
| 348 | else if(result == 83){//get camera sucess | 358 | else if(result == 83){//get camera sucess |
| 349 | if(data_len > 4){ | 359 | if(data_len > 4){ |
| @@ -389,7 +399,7 @@ a:active { | @@ -389,7 +399,7 @@ a:active { | ||
| 389 | } | 399 | } |
| 390 | } | 400 | } |
| 391 | else if(85 == result){//cam_share success | 401 | else if(85 == result){//cam_share success |
| 392 | - playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/cs"); | 402 | + //playRTMPStream("rtmp://127.0.0.1:" + rtmp_port + "/live/cs"); |
| 393 | } | 403 | } |
| 394 | else if(95 == result){//get_videoparam success | 404 | else if(95 == result){//get_videoparam success |
| 395 | var data = new Uint8Array(evt.target.result, 8, evt.target.result.byteLength - 8 -1); | 405 | var data = new Uint8Array(evt.target.result, 8, evt.target.result.byteLength - 8 -1); |
| @@ -517,6 +527,7 @@ a:active { | @@ -517,6 +527,7 @@ a:active { | ||
| 517 | //cmd.data = new TextEncoder("utf-8").encode(param.value); | 527 | //cmd.data = new TextEncoder("utf-8").encode(param.value); |
| 518 | cmd.data = utf16to8(param.value); | 528 | cmd.data = utf16to8(param.value); |
| 519 | cmd.data_len = cmd.data.length; | 529 | cmd.data_len = cmd.data.length; |
| 530 | + checkAndPlayStream(param.value); | ||
| 520 | } | 531 | } |
| 521 | else if(cmdName == "ss_stop"){ | 532 | else if(cmdName == "ss_stop"){ |
| 522 | cmd.type = 7; | 533 | cmd.type = 7; |
| @@ -582,7 +593,7 @@ a:active { | @@ -582,7 +593,7 @@ a:active { | ||
| 582 | for(var i=0;i< mic_name_array.length; i++){ | 593 | for(var i=0;i< mic_name_array.length; i++){ |
| 583 | mic_name[i] = mic_name_array[i]; | 594 | mic_name[i] = mic_name_array[i]; |
| 584 | } | 595 | } |
| 585 | - var url_name = new Uint8Array(buffer, 8 + 256, 256);//todo: set push url | 596 | + var url_name = new Uint8Array(buffer, 8 + 256, 256); |
| 586 | cmd.data = new Uint8Array(buffer, 0, cmd.data_len); | 597 | cmd.data = new Uint8Array(buffer, 0, cmd.data_len); |
| 587 | doSendWSCmd(cmd); | 598 | doSendWSCmd(cmd); |
| 588 | return; | 599 | return; |
| @@ -651,6 +662,7 @@ a:active { | @@ -651,6 +662,7 @@ a:active { | ||
| 651 | var param = document.getElementById("start_push_input"); | 662 | var param = document.getElementById("start_push_input"); |
| 652 | cmd.data = utf16to8(param.value); | 663 | cmd.data = utf16to8(param.value); |
| 653 | cmd.data_len = cmd.data.length; | 664 | cmd.data_len = cmd.data.length; |
| 665 | + checkAndPlayStream(param.value); | ||
| 654 | } | 666 | } |
| 655 | else if(cmdName == "stop_push"){ | 667 | else if(cmdName == "stop_push"){ |
| 656 | cmd.type = 51; | 668 | cmd.type = 51; |
| @@ -764,8 +776,8 @@ function getExplorerTitle() { | @@ -764,8 +776,8 @@ function getExplorerTitle() { | ||
| 764 | queryParameters['type'] = "live"; | 776 | queryParameters['type'] = "live"; |
| 765 | } | 777 | } |
| 766 | 778 | ||
| 767 | - if( queryParameters['source'] == "" ) | ||
| 768 | - queryParameters['source'] = "rtmp://localhost/live/ss"; | 779 | + //if( queryParameters['source'] == "" ) |
| 780 | + // queryParameters['source'] = "rtmp://localhost/live/ss"; | ||
| 769 | 781 | ||
| 770 | if( queryParameters['type'] == "" ) | 782 | if( queryParameters['type'] == "" ) |
| 771 | queryParameters['type'] = "live"; | 783 | queryParameters['type'] = "live"; |
-
请 注册 或 登录 后发表评论