正在显示
1 个修改的文件
包含
93 行增加
和
132 行删除
@@ -483,7 +483,6 @@ function _audioUpdate(callbackDate){ | @@ -483,7 +483,6 @@ function _audioUpdate(callbackDate){ | ||
483 | achieveStuPlayAudioStream(callbackDate); | 483 | achieveStuPlayAudioStream(callbackDate); |
484 | $(".stuPlay").css({"width":"240px","height":"180px"}); | 484 | $(".stuPlay").css({"width":"240px","height":"180px"}); |
485 | $(".teacherVideo").css("background","#f5f9fb"); | 485 | $(".teacherVideo").css("background","#f5f9fb"); |
486 | - $(".teacherVideoBg").css("display","block"); | ||
487 | 486 | ||
488 | } | 487 | } |
489 | 488 | ||
@@ -543,7 +542,7 @@ function achieveStuPushStream() { | @@ -543,7 +542,7 @@ function achieveStuPushStream() { | ||
543 | 542 | ||
544 | //code为0,代表成功 | 543 | //code为0,代表成功 |
545 | if (pubStuResult.code==0){ | 544 | if (pubStuResult.code==0){ |
546 | - if(! window.publishStuflash) { | 545 | + |
547 | flashvideo( | 546 | flashvideo( |
548 | 'stuPublish', | 547 | 'stuPublish', |
549 | '100%', | 548 | '100%', |
@@ -580,16 +579,11 @@ function achieveStuPushStream() { | @@ -580,16 +579,11 @@ function achieveStuPushStream() { | ||
580 | 579 | ||
581 | } | 580 | } |
582 | 581 | ||
583 | - else { | ||
584 | - console.error('stuPublish error'); | ||
585 | - } | 582 | + |
586 | } | 583 | } |
587 | ) | 584 | ) |
588 | 585 | ||
589 | - } | ||
590 | - else { | ||
591 | - publishStuURL(pubStuResult.publishUrl); | ||
592 | - } | 586 | + |
593 | 587 | ||
594 | }else if(pubStuResult.code==1){ | 588 | }else if(pubStuResult.code==1){ |
595 | 589 | ||
@@ -626,7 +620,7 @@ function achieveStuPlayStream(_pubResultObj) { | @@ -626,7 +620,7 @@ function achieveStuPlayStream(_pubResultObj) { | ||
626 | $(".teacherVideo").css("background","#f5f9fb"); | 620 | $(".teacherVideo").css("background","#f5f9fb"); |
627 | // $(".teacherVideoBg").css("display","block"); | 621 | // $(".teacherVideoBg").css("display","block"); |
628 | 622 | ||
629 | - if(! window.playflashStu) { | 623 | + |
630 | flashvideo( | 624 | flashvideo( |
631 | 'stuPlay', | 625 | 'stuPlay', |
632 | '100%', | 626 | '100%', |
@@ -647,12 +641,6 @@ function achieveStuPlayStream(_pubResultObj) { | @@ -647,12 +641,6 @@ function achieveStuPlayStream(_pubResultObj) { | ||
647 | } | 641 | } |
648 | } | 642 | } |
649 | ) | 643 | ) |
650 | - } | ||
651 | - else { | ||
652 | - playStuURL(streamInfo.playUrl); | ||
653 | - } | ||
654 | - | ||
655 | - | ||
656 | } | 644 | } |
657 | 645 | ||
658 | function playStuURL(rtmpURL){ | 646 | function playStuURL(rtmpURL){ |
@@ -678,7 +666,7 @@ function achieveStuVoice() { | @@ -678,7 +666,7 @@ function achieveStuVoice() { | ||
678 | 666 | ||
679 | //code为0,代表成功 | 667 | //code为0,代表成功 |
680 | if (pubStuAudioResult.code==0){ | 668 | if (pubStuAudioResult.code==0){ |
681 | - if(! window.publishflashStuVoice) { | 669 | + |
682 | flashvideo( | 670 | flashvideo( |
683 | 'stuPublish', | 671 | 'stuPublish', |
684 | '100%', | 672 | '100%', |
@@ -713,16 +701,11 @@ function achieveStuVoice() { | @@ -713,16 +701,11 @@ function achieveStuVoice() { | ||
713 | console.log("5,flash把学生音频流关闭成功"); | 701 | console.log("5,flash把学生音频流关闭成功"); |
714 | } | 702 | } |
715 | 703 | ||
716 | - else { | ||
717 | - console.error('publish error'); | ||
718 | - } | 704 | + |
719 | } | 705 | } |
720 | ) | 706 | ) |
721 | 707 | ||
722 | - } | ||
723 | - else { | ||
724 | - publishStuVoiceURL(pubStuAudioResult.publishUrl); | ||
725 | - } | 708 | + |
726 | 709 | ||
727 | }else if(pubStuAudioResult.code==1){ | 710 | }else if(pubStuAudioResult.code==1){ |
728 | 711 | ||
@@ -761,7 +744,7 @@ function achieveStuPlayAudioStream(_pubResultObj){ | @@ -761,7 +744,7 @@ function achieveStuPlayAudioStream(_pubResultObj){ | ||
761 | // $(".teacherVideo").css("background", "#CCCCCC"); | 744 | // $(".teacherVideo").css("background", "#CCCCCC"); |
762 | $(".teacherVideo-voice").css("bottom","4px"); | 745 | $(".teacherVideo-voice").css("bottom","4px"); |
763 | 746 | ||
764 | - if(! window.playflashStuAudio) { | 747 | + |
765 | flashvideo( | 748 | flashvideo( |
766 | 'stuPlay', | 749 | 'stuPlay', |
767 | '100%', | 750 | '100%', |
@@ -779,10 +762,7 @@ function achieveStuPlayAudioStream(_pubResultObj){ | @@ -779,10 +762,7 @@ function achieveStuPlayAudioStream(_pubResultObj){ | ||
779 | console.log(' [play] native 2 js', msg); | 762 | console.log(' [play] native 2 js', msg); |
780 | } | 763 | } |
781 | ) | 764 | ) |
782 | - } | ||
783 | - else { | ||
784 | - stuPlayAudioURL(streamInfo.playUrl); | ||
785 | - } | 765 | + |
786 | 766 | ||
787 | 767 | ||
788 | } | 768 | } |
@@ -800,6 +780,8 @@ function stuPlayAudioURL(rtmpURL){ | @@ -800,6 +780,8 @@ function stuPlayAudioURL(rtmpURL){ | ||
800 | } | 780 | } |
801 | 781 | ||
802 | 782 | ||
783 | + | ||
784 | + | ||
803 | //获取老师只推音频 | 785 | //获取老师只推音频 |
804 | function achieveTeaAudioStream() { | 786 | function achieveTeaAudioStream() { |
805 | $(".publish").css({"width":"240px","height":"180px"}); | 787 | $(".publish").css({"width":"240px","height":"180px"}); |
@@ -812,7 +794,7 @@ function achieveTeaAudioStream() { | @@ -812,7 +794,7 @@ function achieveTeaAudioStream() { | ||
812 | 794 | ||
813 | //code为0,代表成功 | 795 | //code为0,代表成功 |
814 | if (pushTeaAudioResult.code==0){ | 796 | if (pushTeaAudioResult.code==0){ |
815 | - if(! window.publishflashAudio) { | 797 | + |
816 | flashvideo( | 798 | flashvideo( |
817 | 'publish', | 799 | 'publish', |
818 | '100%', | 800 | '100%', |
@@ -846,16 +828,11 @@ function achieveTeaAudioStream() { | @@ -846,16 +828,11 @@ function achieveTeaAudioStream() { | ||
846 | console.log("5,flash把推老师音频流关闭"); | 828 | console.log("5,flash把推老师音频流关闭"); |
847 | 829 | ||
848 | } | 830 | } |
849 | - else { | ||
850 | - console.error('publish error'); | ||
851 | - } | 831 | + |
852 | } | 832 | } |
853 | ) | 833 | ) |
854 | 834 | ||
855 | - } | ||
856 | - else { | ||
857 | - publishTeaAudioURL(pushTeaAudioResult.publishUrl); | ||
858 | - } | 835 | + |
859 | 836 | ||
860 | }else if(pushTeaAudioResult.code==1){ | 837 | }else if(pushTeaAudioResult.code==1){ |
861 | 838 | ||
@@ -876,11 +853,76 @@ function publishTeaAudioURL(rtmpURL) { | @@ -876,11 +853,76 @@ function publishTeaAudioURL(rtmpURL) { | ||
876 | }); | 853 | }); |
877 | console.log(publishflashAudio._js2native(msg)); | 854 | console.log(publishflashAudio._js2native(msg)); |
878 | } | 855 | } |
856 | +//获取老师播放音频流地址 | ||
857 | +function achievePlayAudioStream(_pubResultObj){ | ||
858 | + | ||
859 | + console.log("_pubResultObj==========>",_pubResultObj) | ||
860 | + var _paramInfo={ | ||
861 | + "type": "rtmp", | ||
862 | + "channelId": _pubResultObj.channelId,//频道号 | ||
863 | + "classId": _pubResultObj.classId,//课堂号 | ||
864 | + "siteId": _pubResultObj.siteId,//站点号 | ||
865 | + "timestamp":_pubResultObj.timestamp,//时间戳 | ||
866 | + "userId": _pubResultObj.userId,//userId | ||
867 | + }; | ||
868 | + var streamInfo=client.getAudioPlayPath(_paramInfo); | ||
869 | + console.log("result是=============>",streamInfo); | ||
870 | + $(".play").css({"width":"240px","height":"180px"}); | ||
871 | + $(".publish").css({"width":"1px","height":"1px"}); | ||
872 | + $(".teacherVideoBg").css("display","none"); | ||
873 | + | ||
874 | + | ||
875 | + // $(".teacherVideo").css("background", "#CCCCCC"); | ||
876 | + // $(".teacherVideo-voice").css("bottom","4px"); | ||
877 | + | ||
878 | + | ||
879 | + flashvideo( | ||
880 | + 'play', | ||
881 | + '100%', | ||
882 | + '100%', | ||
883 | + function createPlayReady(error, playflash) { | ||
884 | + if (error) { | ||
885 | + return console.error(error); | ||
886 | + } | ||
887 | + window.playflashAudio = playflash; | ||
888 | + window.playflashAudioId = teaTimeStamp(); | ||
889 | + | ||
890 | + playAudioURL(streamInfo.playUrl); | ||
891 | + }, | ||
892 | + function (msg) { | ||
893 | + console.log(' [playAudio] native 2 js', msg); | ||
894 | + var _msg=JSON.parse(msg); | ||
895 | + console.log("playAudio_msg===========>",_msg); | ||
896 | + if((_msg.data.result == 0)&&(_msg.data.type == 2)){ | ||
897 | + console.log("2,老师播音频流"); | ||
898 | + | ||
899 | + } | ||
900 | + else if ((_msg.data.result == 0)&&(_msg.data.type == 5)){ | ||
901 | + console.log("5,flash把老师的播音频流关闭"); | ||
902 | + } | ||
903 | + | ||
904 | + } | ||
905 | + ) | ||
906 | + | ||
907 | +} | ||
908 | + | ||
909 | +function playAudioURL(rtmpURL){ | ||
910 | + const msg = JSON.stringify({ | ||
911 | + type: 2, | ||
912 | + videoId: playflashAudioId, | ||
913 | + data: { | ||
914 | + url: rtmpURL | ||
915 | + // url:'rtmp://123.56.205.116:1935/live/alexwang' | ||
916 | + } | ||
917 | + }); | ||
918 | + console.log(playflashAudio._js2native(msg)); | ||
919 | +} | ||
920 | + | ||
879 | 921 | ||
880 | - //获取老师推音视频流地址 | ||
881 | -function achieveTeaVideoStream(){ | ||
882 | 922 | ||
883 | 923 | ||
924 | + //获取老师推音视频流地址 | ||
925 | +function achieveTeaVideoStream(){ | ||
884 | var paramInfo={ | 926 | var paramInfo={ |
885 | "type": "flash" | 927 | "type": "flash" |
886 | }; | 928 | }; |
@@ -889,7 +931,6 @@ function achieveTeaVideoStream(){ | @@ -889,7 +931,6 @@ function achieveTeaVideoStream(){ | ||
889 | 931 | ||
890 | //code为0,代表成功 | 932 | //code为0,代表成功 |
891 | if (pushTeaResult.code==0){ | 933 | if (pushTeaResult.code==0){ |
892 | - if(! window.publishflash) { | ||
893 | flashvideo( | 934 | flashvideo( |
894 | 'publish', | 935 | 'publish', |
895 | '100%', | 936 | '100%', |
@@ -923,16 +964,10 @@ function achieveTeaVideoStream(){ | @@ -923,16 +964,10 @@ function achieveTeaVideoStream(){ | ||
923 | else if ((_msg.data.result == 0)&&(_msg.data.type == 5)){ | 964 | else if ((_msg.data.result == 0)&&(_msg.data.type == 5)){ |
924 | console.log("5,flash把老师的推音视频流关闭"); | 965 | console.log("5,flash把老师的推音视频流关闭"); |
925 | } | 966 | } |
926 | - else { | ||
927 | - console.error('publish error'); | ||
928 | - } | 967 | + |
929 | } | 968 | } |
930 | ) | 969 | ) |
931 | - } | ||
932 | - else { | ||
933 | 970 | ||
934 | - publishURL(pushTeaResult.publishUrl); | ||
935 | - } | ||
936 | 971 | ||
937 | }else if(pushTeaResult.code==1){ | 972 | }else if(pushTeaResult.code==1){ |
938 | 973 | ||
@@ -956,80 +991,8 @@ function publishURL(rtmpURL) { | @@ -956,80 +991,8 @@ function publishURL(rtmpURL) { | ||
956 | 991 | ||
957 | } | 992 | } |
958 | 993 | ||
959 | - | ||
960 | - | ||
961 | - //获取老师播放音频流地址 | ||
962 | -function achievePlayAudioStream(_pubResultObj){ | ||
963 | - | ||
964 | - console.log("_pubResultObj==========>",_pubResultObj) | ||
965 | - var _paramInfo={ | ||
966 | - "type": "rtmp", | ||
967 | - "channelId": _pubResultObj.channelId,//频道号 | ||
968 | - "classId": _pubResultObj.classId,//课堂号 | ||
969 | - "siteId": _pubResultObj.siteId,//站点号 | ||
970 | - "timestamp":_pubResultObj.timestamp,//时间戳 | ||
971 | - "userId": _pubResultObj.userId,//userId | ||
972 | - }; | ||
973 | - var streamInfo=client.getAudioPlayPath(_paramInfo); | ||
974 | - console.log("result是=============>",streamInfo); | ||
975 | - $(".play").css({"width":"240px","height":"180px"}); | ||
976 | - $(".publish").css({"width":"1px","height":"1px"}); | ||
977 | - $(".teacherVideoBg").css("display","none"); | ||
978 | - | ||
979 | - | ||
980 | - // $(".teacherVideo").css("background", "#CCCCCC"); | ||
981 | - $(".teacherVideo-voice").css("bottom","4px"); | ||
982 | - | ||
983 | - if(! window.playflashAudio) { | ||
984 | - flashvideo( | ||
985 | - 'play', | ||
986 | - '100%', | ||
987 | - '100%', | ||
988 | - function createPlayReady(error, playflash) { | ||
989 | - if (error) { | ||
990 | - return console.error(error); | ||
991 | - } | ||
992 | - window.playflashAudio = playflash; | ||
993 | - window.playflashAudioId = teaTimeStamp(); | ||
994 | - | ||
995 | - playAudioURL(streamInfo.playUrl); | ||
996 | - }, | ||
997 | - function (msg) { | ||
998 | - console.log(' [playAudio] native 2 js', msg); | ||
999 | - var _msg=JSON.parse(msg); | ||
1000 | - console.log("playAudio_msg===========>",_msg); | ||
1001 | - if((_msg.data.result == 0)&&(_msg.data.type == 2)){ | ||
1002 | - console.log("2,老师播音频流"); | ||
1003 | - | ||
1004 | - } | ||
1005 | - else if ((_msg.data.result == 0)&&(_msg.data.type == 5)){ | ||
1006 | - console.log("5,flash把老师的播音频流关闭"); | ||
1007 | - } | ||
1008 | - else { | ||
1009 | - console.error('playAudio error'); | ||
1010 | - } | ||
1011 | - } | ||
1012 | - ) | ||
1013 | - } | ||
1014 | - else { | ||
1015 | - playAudioURL(streamInfo.playUrl); | ||
1016 | - } | ||
1017 | -} | ||
1018 | - | ||
1019 | -function playAudioURL(rtmpURL){ | ||
1020 | - const msg = JSON.stringify({ | ||
1021 | - type: 2, | ||
1022 | - videoId: playflashAudioId, | ||
1023 | - data: { | ||
1024 | - url: rtmpURL | ||
1025 | - // url:'rtmp://123.56.205.116:1935/live/alexwang' | ||
1026 | - } | ||
1027 | - }); | ||
1028 | - console.log(playflashAudio._js2native(msg)); | ||
1029 | -} | ||
1030 | - | ||
1031 | - //获取老师播音视频流地址 | ||
1032 | - function achievePlayStream(_pubResultObj){ | 994 | +//获取老师播音视频流地址 |
995 | +function achievePlayStream(_pubResultObj){ | ||
1033 | console.log("_pubResultObj==========>",_pubResultObj) | 996 | console.log("_pubResultObj==========>",_pubResultObj) |
1034 | var _paramInfo={ | 997 | var _paramInfo={ |
1035 | "type": "rtmp", | 998 | "type": "rtmp", |
@@ -1046,7 +1009,7 @@ function playAudioURL(rtmpURL){ | @@ -1046,7 +1009,7 @@ function playAudioURL(rtmpURL){ | ||
1046 | $(".teacherVideoBg").css("display","none"); | 1009 | $(".teacherVideoBg").css("display","none"); |
1047 | $(".teacherVideo-voice").css("bottom","4px"); | 1010 | $(".teacherVideo-voice").css("bottom","4px"); |
1048 | 1011 | ||
1049 | - if(! window.playflash) { | 1012 | + |
1050 | flashvideo( | 1013 | flashvideo( |
1051 | 'play', | 1014 | 'play', |
1052 | '100%', | 1015 | '100%', |
@@ -1071,20 +1034,15 @@ function playAudioURL(rtmpURL){ | @@ -1071,20 +1034,15 @@ function playAudioURL(rtmpURL){ | ||
1071 | else if ((_msg.data.result == 0)&&(_msg.data.type == 5)){ | 1034 | else if ((_msg.data.result == 0)&&(_msg.data.type == 5)){ |
1072 | console.log("5,flash把老师的播音视频流关闭"); | 1035 | console.log("5,flash把老师的播音视频流关闭"); |
1073 | } | 1036 | } |
1074 | - else { | ||
1075 | - console.error('play error'); | ||
1076 | - } | 1037 | + |
1077 | 1038 | ||
1078 | 1039 | ||
1079 | } | 1040 | } |
1080 | ) | 1041 | ) |
1081 | - } | ||
1082 | - else { | ||
1083 | - playURL(streamInfo.playUrl); | ||
1084 | - } | ||
1085 | - } | ||
1086 | 1042 | ||
1087 | - function playURL(rtmpURL) { | 1043 | +} |
1044 | + | ||
1045 | +function playURL(rtmpURL) { | ||
1088 | const msg = JSON.stringify({ | 1046 | const msg = JSON.stringify({ |
1089 | type: 2, | 1047 | type: 2, |
1090 | videoId: playflashVideoId, | 1048 | videoId: playflashVideoId, |
@@ -1095,6 +1053,9 @@ function playAudioURL(rtmpURL){ | @@ -1095,6 +1053,9 @@ function playAudioURL(rtmpURL){ | ||
1095 | }); | 1053 | }); |
1096 | 1054 | ||
1097 | console.log(playflash._js2native(msg)); | 1055 | console.log(playflash._js2native(msg)); |
1098 | - } | 1056 | +} |
1057 | + | ||
1058 | + | ||
1059 | + | ||
1099 | 1060 | ||
1100 | 1061 |
-
请 注册 或 登录 后发表评论