正在显示
4 个修改的文件
包含
220 行增加
和
98 行删除
| @@ -16,8 +16,8 @@ | @@ -16,8 +16,8 @@ | ||
| 16 | <script type="text/javascript" src="js/xdyEvent.js"></script> | 16 | <script type="text/javascript" src="js/xdyEvent.js"></script> |
| 17 | <script type="text/javascript" src="js/drag.js"></script> | 17 | <script type="text/javascript" src="js/drag.js"></script> |
| 18 | 18 | ||
| 19 | - <!--<script type="text/javascript" src="js/McuClient.js?v=1.0.228.14"></script>--> | ||
| 20 | - <script type="text/javascript" src="http://192.168.1.140/McuClient/McuClient.js?7213236"></script> | 19 | + <script type="text/javascript" src="js/McuClient.js?v=1.0.0302.19"></script> |
| 20 | + <!--<script type="text/javascript" src="http://192.168.1.140/McuClient/McuClient.js?722990836"></script>--> | ||
| 21 | <script type="text/javascript" src="js/jquery-1.11.3.min.js"></script> | 21 | <script type="text/javascript" src="js/jquery-1.11.3.min.js"></script> |
| 22 | 22 | ||
| 23 | <script type="text/javascript" src="src/main.js"></script> | 23 | <script type="text/javascript" src="src/main.js"></script> |
| @@ -590,7 +590,7 @@ | @@ -590,7 +590,7 @@ | ||
| 590 | 590 | ||
| 591 | <div class="fourParamsOut"> | 591 | <div class="fourParamsOut"> |
| 592 | <ul class="fourParams clear"> | 592 | <ul class="fourParams clear"> |
| 593 | - <li><span>classId:</span><input class="classId" type="text" value="1154006572"></li> | 593 | + <li><span>classId:</span><input class="classId" type="text" value="1215295269"></li> |
| 594 | <!--<li><span>userRole:</span><input class="userRole" type="text" value=""></li>--> | 594 | <!--<li><span>userRole:</span><input class="userRole" type="text" value=""></li>--> |
| 595 | <!--<li><span>portal:</span><input class="portal" type="text" value=""></li>--> | 595 | <!--<li><span>portal:</span><input class="portal" type="text" value=""></li>--> |
| 596 | <li><span>userId:</span><input class="userId" type="text" value=""></li> | 596 | <li><span>userId:</span><input class="userId" type="text" value=""></li> |
此 diff 太大无法显示。
| @@ -374,12 +374,21 @@ function showInter(_data,isPage){ | @@ -374,12 +374,21 @@ function showInter(_data,isPage){ | ||
| 374 | $("#totalPageNum").html(pageNum); | 374 | $("#totalPageNum").html(pageNum); |
| 375 | 375 | ||
| 376 | console.log("curPageNum",curPageNum); | 376 | console.log("curPageNum",curPageNum); |
| 377 | - for (var i=0;i<docfullPath.length;i++){ | ||
| 378 | - var docfullSingle=docfullPath[curPageNum-1]; | 377 | + var docfullSingle=docfullPath[curPageNum-1]; |
| 378 | + | ||
| 379 | + if(docfullSingle){ | ||
| 379 | $("#docImage").attr("src",docfullSingle); | 380 | $("#docImage").attr("src",docfullSingle); |
| 381 | + }else { | ||
| 382 | + | ||
| 380 | } | 383 | } |
| 381 | 384 | ||
| 382 | 385 | ||
| 386 | + /* for (var i=0;i<docfullPath.length;i++){ | ||
| 387 | + var docfullSingle=docfullPath[curPageNum-1]; | ||
| 388 | + $("#docImage").attr("src",docfullSingle); | ||
| 389 | + }*/ | ||
| 390 | + | ||
| 391 | + | ||
| 383 | 392 | ||
| 384 | 393 | ||
| 385 | 394 | ||
| @@ -925,11 +934,10 @@ function layoutView( ) { | @@ -925,11 +934,10 @@ function layoutView( ) { | ||
| 925 | 934 | ||
| 926 | if (curPageNum!==pageNum){ | 935 | if (curPageNum!==pageNum){ |
| 927 | console.log(curPageNum); | 936 | console.log(curPageNum); |
| 928 | - for (var i=0;i<docfullPath.length;i++){ | ||
| 929 | var docfullSingle=docfullPath[curPageNum-1]; | 937 | var docfullSingle=docfullPath[curPageNum-1]; |
| 930 | console.log("curPageNum,docfullSingle",curPageNum,docfullSingle); | 938 | console.log("curPageNum,docfullSingle",curPageNum,docfullSingle); |
| 931 | $("#docImage").attr("src",docfullSingle); | 939 | $("#docImage").attr("src",docfullSingle); |
| 932 | - } | 940 | + |
| 933 | // curPageNum++; | 941 | // curPageNum++; |
| 934 | } | 942 | } |
| 935 | 943 | ||
| @@ -941,11 +949,11 @@ function layoutView( ) { | @@ -941,11 +949,11 @@ function layoutView( ) { | ||
| 941 | $(".spinner1").css("display","block"); | 949 | $(".spinner1").css("display","block"); |
| 942 | if (curPageNum>1){ | 950 | if (curPageNum>1){ |
| 943 | console.log("curPageNum",curPageNum); | 951 | console.log("curPageNum",curPageNum); |
| 944 | - for (var i=0;i<docfullPath.length;i++){ | 952 | + |
| 945 | var docfullSingle=docfullPath[curPageNum-1]; | 953 | var docfullSingle=docfullPath[curPageNum-1]; |
| 946 | console.log("curPageNum,docfullSingle",curPageNum,docfullSingle); | 954 | console.log("curPageNum,docfullSingle",curPageNum,docfullSingle); |
| 947 | $("#docImage").attr("src",docfullSingle); | 955 | $("#docImage").attr("src",docfullSingle); |
| 948 | - } | 956 | + |
| 949 | } | 957 | } |
| 950 | console.log(curPageNum); | 958 | console.log(curPageNum); |
| 951 | var paramInfo={ | 959 | var paramInfo={ |
| @@ -14,7 +14,9 @@ var videoWithFlash={}; | @@ -14,7 +14,9 @@ var videoWithFlash={}; | ||
| 14 | var pushTeaResult; //推老师音视频结果 | 14 | var pushTeaResult; //推老师音视频结果 |
| 15 | 15 | ||
| 16 | var pushTeaAudioResult; //推老师音频结果 | 16 | var pushTeaAudioResult; //推老师音频结果 |
| 17 | +var pubStuResult; //推学生音视频结果 | ||
| 17 | 18 | ||
| 19 | +var pubStuAudioResult; //推学生音频结果 | ||
| 18 | 20 | ||
| 19 | window.videoWithFlash=videoWithFlash; | 21 | window.videoWithFlash=videoWithFlash; |
| 20 | 22 | ||
| @@ -40,11 +42,13 @@ $(function () { | @@ -40,11 +42,13 @@ $(function () { | ||
| 40 | //学生视频按钮点击 | 42 | //学生视频按钮点击 |
| 41 | $("#stuVideo-video").click(function (e) { | 43 | $("#stuVideo-video").click(function (e) { |
| 42 | console.log("stuVideo-video点击"); | 44 | console.log("stuVideo-video点击"); |
| 43 | - $(".stuVideoBg").css("display","none"); | ||
| 44 | - $(".stuVideo-videoBg").css("display","block"); | ||
| 45 | - $(".stuVideo-video").css("display","none"); | ||
| 46 | - $(".studentVideo").css("background", "#CCCCCC"); | ||
| 47 | - $(".stuVideo-voice").css("bottom","4px"); | 45 | + |
| 46 | + if (classAllInfo.userRole=="host"){ | ||
| 47 | + $(".stuVideoBg").css("display","none"); | ||
| 48 | + $(".stuVideo-videoBg").css("display","block"); | ||
| 49 | + $(".stuVideo-video").css("display","none"); | ||
| 50 | + $(".stuVideo-voice").css("bottom","4px"); | ||
| 51 | + } | ||
| 48 | 52 | ||
| 49 | var paramInfo={ | 53 | var paramInfo={ |
| 50 | "actionType":1, | 54 | "actionType":1, |
| @@ -69,6 +73,10 @@ $(function () { | @@ -69,6 +73,10 @@ $(function () { | ||
| 69 | "data":"0" | 73 | "data":"0" |
| 70 | }; | 74 | }; |
| 71 | client.sendVideoBroadcastMsg(paramInfo); | 75 | client.sendVideoBroadcastMsg(paramInfo); |
| 76 | + | ||
| 77 | + | ||
| 78 | + | ||
| 79 | + | ||
| 72 | $("#stuVideo-video").css("display","block"); | 80 | $("#stuVideo-video").css("display","block"); |
| 73 | $("#stuVideo-videoBg").css("display","none"); | 81 | $("#stuVideo-videoBg").css("display","none"); |
| 74 | 82 | ||
| @@ -79,14 +87,19 @@ $(function () { | @@ -79,14 +87,19 @@ $(function () { | ||
| 79 | $("#stuVideo-voice").click(function (e) { | 87 | $("#stuVideo-voice").click(function (e) { |
| 80 | 88 | ||
| 81 | console.log("stuVideo-voice点击"); | 89 | console.log("stuVideo-voice点击"); |
| 90 | + | ||
| 91 | + if (classAllInfo.userRole=="host"){ | ||
| 92 | + $(".stuVideoBg").css("display","none"); | ||
| 93 | + $(".stuVideo-voiceBg").css("display","block"); | ||
| 94 | + $(".stuVideo-voice").css("display","none"); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + | ||
| 82 | var stuVideoDisplay= $(".stuVideo-videoBg").css("display"); | 98 | var stuVideoDisplay= $(".stuVideo-videoBg").css("display"); |
| 83 | if(stuVideoDisplay=="block"){ | 99 | if(stuVideoDisplay=="block"){ |
| 84 | $("#stuVideo-videoBg").trigger("click"); | 100 | $("#stuVideo-videoBg").trigger("click"); |
| 85 | } | 101 | } |
| 86 | - $("#stuVideo-voice").css("display","none"); | ||
| 87 | - $("#stuVideo-voiceBg").css("display","block"); | ||
| 88 | - $(".stuPublish").css("display","none"); | ||
| 89 | - $(".studentVideoBg").css("display","none"); | 102 | + |
| 90 | 103 | ||
| 91 | var paramInfo={ | 104 | var paramInfo={ |
| 92 | "actionType":1, | 105 | "actionType":1, |
| @@ -98,12 +111,14 @@ $(function () { | @@ -98,12 +111,14 @@ $(function () { | ||
| 98 | if (classAllInfo.userRole=="normal"){ | 111 | if (classAllInfo.userRole=="normal"){ |
| 99 | $(".stuVideo-voice").css("display","none"); | 112 | $(".stuVideo-voice").css("display","none"); |
| 100 | $(".stuVideo-video").css("display","none"); | 113 | $(".stuVideo-video").css("display","none"); |
| 114 | + $("#stuVideo-voice").css("display","none"); | ||
| 115 | + $("#stuVideo-voiceBg").css("display","block"); | ||
| 116 | + $(".stuPublish").css({"width":"240px","height":"180px"}); | ||
| 117 | + $(".studentVideoBg").css("display","none"); | ||
| 101 | } | 118 | } |
| 102 | 119 | ||
| 103 | 120 | ||
| 104 | }); | 121 | }); |
| 105 | - | ||
| 106 | - | ||
| 107 | //学生音频关闭按钮点击 | 122 | //学生音频关闭按钮点击 |
| 108 | $("#stuVideo-voiceBg").click(function(e){ | 123 | $("#stuVideo-voiceBg").click(function(e){ |
| 109 | var paramInfo={ | 124 | var paramInfo={ |
| @@ -139,13 +154,13 @@ $(function () { | @@ -139,13 +154,13 @@ $(function () { | ||
| 139 | $(".teacherVideo").css("background", "#CCCCCC"); | 154 | $(".teacherVideo").css("background", "#CCCCCC"); |
| 140 | $(".teacherVideo-voice").css("bottom","4px"); | 155 | $(".teacherVideo-voice").css("bottom","4px"); |
| 141 | $(".teacherVoicing").css("display","none"); | 156 | $(".teacherVoicing").css("display","none"); |
| 157 | + | ||
| 142 | } | 158 | } |
| 143 | 159 | ||
| 144 | //获取推流地址 | 160 | //获取推流地址 |
| 145 | achieveTeaVideoStream(); | 161 | achieveTeaVideoStream(); |
| 146 | 162 | ||
| 147 | }); | 163 | }); |
| 148 | - | ||
| 149 | //老师视频关闭按钮点击 | 164 | //老师视频关闭按钮点击 |
| 150 | $("#teacherVideo-videoBg").click(function (e) { | 165 | $("#teacherVideo-videoBg").click(function (e) { |
| 151 | if(window.publishflash) { | 166 | if(window.publishflash) { |
| @@ -177,7 +192,6 @@ $(function () { | @@ -177,7 +192,6 @@ $(function () { | ||
| 177 | 192 | ||
| 178 | 193 | ||
| 179 | }); | 194 | }); |
| 180 | - | ||
| 181 | //老师音频按钮点击 | 195 | //老师音频按钮点击 |
| 182 | $("#teacherVideo-voice").click(function (e) { | 196 | $("#teacherVideo-voice").click(function (e) { |
| 183 | console.log("teacherVideo-voice点击"); | 197 | console.log("teacherVideo-voice点击"); |
| @@ -198,7 +212,6 @@ $(function () { | @@ -198,7 +212,6 @@ $(function () { | ||
| 198 | achieveTeaAudioStream(); | 212 | achieveTeaAudioStream(); |
| 199 | 213 | ||
| 200 | }); | 214 | }); |
| 201 | - | ||
| 202 | //老师音频关闭按钮点击 | 215 | //老师音频关闭按钮点击 |
| 203 | $("#teacherVideo-voiceBg").click(function (e) { | 216 | $("#teacherVideo-voiceBg").click(function (e) { |
| 204 | 217 | ||
| @@ -229,35 +242,53 @@ $(function () { | @@ -229,35 +242,53 @@ $(function () { | ||
| 229 | }); | 242 | }); |
| 230 | //监听学生视频更新 | 243 | //监听学生视频更新 |
| 231 | function stuBroadcast(callbackDate){ | 244 | function stuBroadcast(callbackDate){ |
| 245 | + if(callbackDate.fromNodeId === classAllInfo.nodeId) return; | ||
| 246 | + | ||
| 232 | if (callbackDate.actionType==1){ | 247 | if (callbackDate.actionType==1){ |
| 233 | - $(".stuVideoBg").css("display","none"); | 248 | + |
| 234 | if(classAllInfo.userRole=="normal"){ | 249 | if(classAllInfo.userRole=="normal"){ |
| 250 | + $(".stuPublish").css({"width":"240px","height":"180px"}); | ||
| 251 | + $(".stuPlay").css({"width":"1px","height":"1px"}); | ||
| 252 | + $(".stuVideoBg").css("display","none"); | ||
| 235 | //获取推流地址 | 253 | //获取推流地址 |
| 236 | achieveStuPushStream(); | 254 | achieveStuPushStream(); |
| 237 | } | 255 | } |
| 256 | + if(classAllInfo.userRole=="host"){ | ||
| 257 | + $(".stuVideoBg").css("display","none"); | ||
| 258 | + } | ||
| 259 | + | ||
| 238 | } | 260 | } |
| 239 | - if(callbackDate.actionType==2){ | 261 | + else if(callbackDate.actionType==2){ |
| 262 | + if(classAllInfo.userRole=="normal"){ | ||
| 263 | + | ||
| 264 | + var paramInfo={ | ||
| 265 | + "nodeId": Number(classAllInfo.nodeId)//用户的nodeId | ||
| 266 | + }; | ||
| 267 | + console.log("stopPublishVideo==========>",paramInfo); | ||
| 268 | + client.stopPublishVideo(paramInfo); | ||
| 269 | + $(".stuPublish").css({"width":"1px","height":"1px"}); | ||
| 270 | + $(".stuPlay").css({"width":"1px","height":"1px"}); | ||
| 271 | + $(".stuVideo-video").css("display","none"); | ||
| 272 | + $(".stuVideoBg").css("display","block"); | ||
| 273 | + | ||
| 274 | + | ||
| 275 | + }else if (classAllInfo.userRole=="host"){ | ||
| 276 | + // $(".stuPublish").css({"width":"1px","height":"1px"}); | ||
| 277 | + // $(".stuPlay").css({"width":"1px","height":"1px"}); | ||
| 278 | + // $(".studentVideo").css("background", "#f5f9fb"); | ||
| 279 | + // $("#stuVideo-voice").css("display","block"); | ||
| 280 | + // $("#stuVideo-voiceBg").css("display","none"); | ||
| 281 | + // $(".stuVideoBg").css("display","block"); | ||
| 282 | + | ||
| 283 | + } | ||
| 284 | + | ||
| 240 | if(window.publishStuflash) { | 285 | if(window.publishStuflash) { |
| 241 | const stopStuInfo = JSON.stringify({ | 286 | const stopStuInfo = JSON.stringify({ |
| 242 | type: 5, | 287 | type: 5, |
| 243 | videoId: publishflashStuVideoId, | 288 | videoId: publishflashStuVideoId, |
| 244 | }); | 289 | }); |
| 245 | - console.log(publishStuflash._js2native(stopStuInfo)); | ||
| 246 | - } | ||
| 247 | 290 | ||
| 248 | - var paramInfo={ | ||
| 249 | - "nodeId": Number(stuNodeId)//用户的nodeId | ||
| 250 | - }; | ||
| 251 | - client.stopPublishVideo(paramInfo); | ||
| 252 | - $(".stuPlay").css("display","none"); | ||
| 253 | - $(".stuPublish").css("display","none"); | ||
| 254 | - $(".studentVideo").css("background", "#f5f9fb"); | ||
| 255 | - $(".stuVideoBg").css("display","block"); | ||
| 256 | - $("#stuVideo-voice").css("display","block"); | ||
| 257 | - $("#stuVideo-voiceBg").css("display","none"); | ||
| 258 | - | ||
| 259 | - if (classAllInfo.userRole=="normal"){ | ||
| 260 | - $(".stuVideo-video").css("display","none"); | 291 | + console.log(publishStuflash._js2native(stopStuInfo)); |
| 261 | } | 292 | } |
| 262 | } | 293 | } |
| 263 | 294 | ||
| @@ -267,9 +298,10 @@ function stuBroadcast(callbackDate){ | @@ -267,9 +298,10 @@ function stuBroadcast(callbackDate){ | ||
| 267 | 298 | ||
| 268 | //监听学生音频更新 | 299 | //监听学生音频更新 |
| 269 | function stuAudioBroadcast(callbackDate){ | 300 | function stuAudioBroadcast(callbackDate){ |
| 301 | + if(callbackDate.fromNodeId === classAllInfo.nodeId) return; | ||
| 270 | if (callbackDate.actionType==1){ | 302 | if (callbackDate.actionType==1){ |
| 271 | $(".stuVideoBg").css("display","none"); | 303 | $(".stuVideoBg").css("display","none"); |
| 272 | - $(".stuPlay").css("display","none"); | 304 | + $(".stuPlay").css({"width":"1px","height":"1px"}); |
| 273 | if(classAllInfo.userRole=="normal"){ | 305 | if(classAllInfo.userRole=="normal"){ |
| 274 | //获取学生只推音频地址 | 306 | //获取学生只推音频地址 |
| 275 | achieveStuVoice(); | 307 | achieveStuVoice(); |
| @@ -289,8 +321,8 @@ function stuAudioBroadcast(callbackDate){ | @@ -289,8 +321,8 @@ function stuAudioBroadcast(callbackDate){ | ||
| 289 | }; | 321 | }; |
| 290 | client.stopPublishAudio(paramInfo); | 322 | client.stopPublishAudio(paramInfo); |
| 291 | 323 | ||
| 292 | - $(".stuPlay").css("display","none"); | ||
| 293 | - $(".stuPublish").css("display","none"); | 324 | + $(".stuPlay").css({"width":"1px","height":"1px"}); |
| 325 | + $(".stuPublish").css({"width":"1px","height":"1px"}); | ||
| 294 | $(".studentVideo").css("background", "#f5f9fb"); | 326 | $(".studentVideo").css("background", "#f5f9fb"); |
| 295 | $(".stuVideoBg").css("display","block"); | 327 | $(".stuVideoBg").css("display","block"); |
| 296 | $("#stuVideo-video").css("display","block"); | 328 | $("#stuVideo-video").css("display","block"); |
| @@ -299,6 +331,7 @@ function stuAudioBroadcast(callbackDate){ | @@ -299,6 +331,7 @@ function stuAudioBroadcast(callbackDate){ | ||
| 299 | if (classAllInfo.userRole=="normal"){ | 331 | if (classAllInfo.userRole=="normal"){ |
| 300 | $(".stuVideo-voice").css("display","none"); | 332 | $(".stuVideo-voice").css("display","none"); |
| 301 | $(".stuVideo-video").css("display","none"); | 333 | $(".stuVideo-video").css("display","none"); |
| 334 | + $(".stuPublish").css({"width":"240px","height":"180px"}); | ||
| 302 | } | 335 | } |
| 303 | } | 336 | } |
| 304 | } | 337 | } |
| @@ -320,75 +353,84 @@ function userListUpdate(callbackData) { | @@ -320,75 +353,84 @@ function userListUpdate(callbackData) { | ||
| 320 | 353 | ||
| 321 | // 监听当前是否有视频流更新 | 354 | // 监听当前是否有视频流更新 |
| 322 | function _videoUpdate(callbackDate){ | 355 | function _videoUpdate(callbackDate){ |
| 323 | - | ||
| 324 | console.log("videoUpdate==============>",callbackDate); | 356 | console.log("videoUpdate==============>",callbackDate); |
| 357 | + if (callbackDate.fromNodeId==classAllInfo.nodeId) return; | ||
| 325 | 358 | ||
| 326 | - // alert((classAllInfo.userRole=="host")&&(callbackDate.status==1)&&(callbackDate.fromNodeId==stuNodeId)); | ||
| 327 | 359 | ||
| 328 | if((classAllInfo.userRole=="host")&&(callbackDate.status==1)&&(callbackDate.fromNodeId==stuNodeId)){ | 360 | if((classAllInfo.userRole=="host")&&(callbackDate.status==1)&&(callbackDate.fromNodeId==stuNodeId)){ |
| 361 | + | ||
| 329 | //获取学生播流地址 | 362 | //获取学生播流地址 |
| 330 | achieveStuPlayStream(callbackDate); | 363 | achieveStuPlayStream(callbackDate); |
| 331 | - | ||
| 332 | - $(".teacherVideo").css("background","#f5f9fb"); | ||
| 333 | - $(".teacherVideoBg").css("display","block"); | ||
| 334 | - | ||
| 335 | } | 364 | } |
| 365 | + if ((classAllInfo.userRole=="normal")&&(callbackDate.status==1)&&(callbackDate.fromNodeId==stuNodeId)){ | ||
| 336 | 366 | ||
| 337 | - if ((classAllInfo.userRole=="normal")&&(callbackDate.status==1)&&(callbackDate.channelId!=='')&&(callbackDate.fromNodeId==stuNodeId)){ | ||
| 338 | - | 367 | + //获取老师播流地址 |
| 339 | achievePlayStream(callbackDate); | 368 | achievePlayStream(callbackDate); |
| 340 | 369 | ||
| 341 | } | 370 | } |
| 342 | - | ||
| 343 | //流的状态为0 | 371 | //流的状态为0 |
| 372 | + if((classAllInfo.userRole=="host")&&(callbackDate.status==0)&&(callbackDate.fromNodeId == stuNodeId)){ | ||
| 373 | + //学生的流关闭 | ||
| 374 | + if (window.playflashStu) { | ||
| 375 | + const stopStuInfo = JSON.stringify({ | ||
| 376 | + type: 5, | ||
| 377 | + videoId: playflashStuVideoId, | ||
| 378 | + }); | ||
| 379 | + console.log(playflashStu._js2native(stopStuInfo)); | ||
| 380 | + } | ||
| 381 | + $(".stuPublish").css({"width":"1px","height":"1px"}); | ||
| 382 | + $(".stuPlay").css({"width":"1px","height":"1px"}); | ||
| 383 | + $(".studentVideo").css("background", "#f5f9fb"); | ||
| 384 | + $("#stuVideo-voice").css("display","block"); | ||
| 385 | + $("#stuVideo-voiceBg").css("display","none"); | ||
| 386 | + $(".stuVideoBg").css("display","block"); | ||
| 387 | + | ||
| 388 | + } | ||
| 389 | + if((classAllInfo.userRole=="normal")&&(callbackDate.status==0)&&(callbackDate.fromNodeId == stuNodeId)){ | ||
| 390 | + //老师的流关闭 | ||
| 391 | + if(window.playflash){ | ||
| 392 | + | ||
| 393 | + const stopPlayInfo = JSON.stringify({ | ||
| 394 | + type: 5, | ||
| 395 | + videoId: playflashVideoId | ||
| 396 | + }); | ||
| 397 | + console.log(playflash._js2native(stopPlayInfo)); | ||
| 398 | + } | ||
| 399 | + $(".play").css({"width":"1px","height":"1px"}); | ||
| 400 | + $(".stuVideo-voice").css("display","none"); | ||
| 401 | + $(".teacherVideoBg").css("display","block"); | ||
| 402 | + $(".teacherVideo").css("background", "#f5f9fb"); | ||
| 403 | + | ||
| 404 | + | ||
| 344 | 405 | ||
| 345 | - if(callbackDate.status==0){ | ||
| 346 | 406 | ||
| 347 | - console.log("callbackDate.fromNodeId,stuNodeId"); | ||
| 348 | - console.log(callbackDate.fromNodeId,stuNodeId); | ||
| 349 | - if(callbackDate.fromNodeId==stuNodeId){ | ||
| 350 | - if (classAllInfo.userRole=="normal"){ | ||
| 351 | - $(".play").css({"width":"1px","height":"1px"}); | ||
| 352 | - } | ||
| 353 | 407 | ||
| 354 | - // $(".play").css("display","none"); | ||
| 355 | - $(".teacherVideoBg").css("display","block"); | ||
| 356 | - $(".teacherVideo").css("background", "#f5f9fb"); | ||
| 357 | - if(window.playflash){ | ||
| 358 | - console.log("playflashVideoId",playflashVideoId); | ||
| 359 | - const stopPlayInfo = JSON.stringify({ | ||
| 360 | - type: 5, | ||
| 361 | - videoId: playflashVideoId | ||
| 362 | - }); | ||
| 363 | - console.log(playflash._js2native(stopPlayInfo)); | ||
| 364 | - } | ||
| 365 | - } | ||
| 366 | } | 408 | } |
| 367 | 409 | ||
| 410 | + | ||
| 368 | } | 411 | } |
| 369 | // 监听当前是否有音频流更新 | 412 | // 监听当前是否有音频流更新 |
| 370 | function _audioUpdate(callbackDate){ | 413 | function _audioUpdate(callbackDate){ |
| 371 | 414 | ||
| 415 | + if (callbackDate.fromNodeId==classAllInfo.nodeId) return; | ||
| 372 | if((classAllInfo.userRole=="host")&&(callbackDate.status==1)&&(callbackDate.fromNodeId==stuNodeId)){ | 416 | if((classAllInfo.userRole=="host")&&(callbackDate.status==1)&&(callbackDate.fromNodeId==stuNodeId)){ |
| 373 | - //获取学生播流地址 | ||
| 374 | - achieveStuPlayStream(callbackDate); | ||
| 375 | - $(".stuPlay").css("display","block"); | ||
| 376 | 417 | ||
| 418 | + //获取学生播放音频地址 | ||
| 419 | + achieveStuPlayAudioStream(callbackDate); | ||
| 420 | + $(".stuPlay").css({"width":"240px","height":"180px"}); | ||
| 377 | $(".teacherVideo").css("background","#f5f9fb"); | 421 | $(".teacherVideo").css("background","#f5f9fb"); |
| 378 | $(".teacherVideoBg").css("display","block"); | 422 | $(".teacherVideoBg").css("display","block"); |
| 379 | 423 | ||
| 380 | } | 424 | } |
| 381 | 425 | ||
| 382 | 426 | ||
| 383 | - if ((classAllInfo.userRole=="normal")&&(callbackDate.status==1)&&(callbackDate.channelId!=='')&&(callbackDate.fromNodeId==stuNodeId)){ | 427 | + if ((classAllInfo.userRole=="normal")&&(callbackDate.status==1)&&(callbackDate.fromNodeId==stuNodeId)){ |
| 384 | achievePlayAudioStream(callbackDate); | 428 | achievePlayAudioStream(callbackDate); |
| 385 | 429 | ||
| 386 | } | 430 | } |
| 387 | if(callbackDate.status==0){ | 431 | if(callbackDate.status==0){ |
| 388 | $(".teacherVideoBg").css("display","block"); | 432 | $(".teacherVideoBg").css("display","block"); |
| 389 | $(".teacherVideo").css("background", "#f5f9fb"); | 433 | $(".teacherVideo").css("background", "#f5f9fb"); |
| 390 | - | ||
| 391 | - | ||
| 392 | if(window.playflashAudio) { | 434 | if(window.playflashAudio) { |
| 393 | console.log("playflashVoiceId", playflashAudioId); | 435 | console.log("playflashVoiceId", playflashAudioId); |
| 394 | 436 | ||
| @@ -404,20 +446,30 @@ function _audioUpdate(callbackDate){ | @@ -404,20 +446,30 @@ function _audioUpdate(callbackDate){ | ||
| 404 | console.log(playflashAudio._js2native(stopPlayInfo)); | 446 | console.log(playflashAudio._js2native(stopPlayInfo)); |
| 405 | } | 447 | } |
| 406 | } | 448 | } |
| 449 | + if(window.playflashStuAudio) { | ||
| 450 | + const stopStuInfo = JSON.stringify({ | ||
| 451 | + type: 5, | ||
| 452 | + videoId: playflashStuAudioId, | ||
| 453 | + }); | ||
| 454 | + console.log(playflashStuAudio._js2native(stopStuInfo)); | ||
| 455 | + } | ||
| 456 | + | ||
| 457 | + | ||
| 458 | + | ||
| 459 | + | ||
| 407 | } | 460 | } |
| 408 | 461 | ||
| 409 | 462 | ||
| 410 | 463 | ||
| 411 | } | 464 | } |
| 412 | 465 | ||
| 413 | -// //获取学生推流地址 | 466 | +// //获取学生推音视频流地址 |
| 414 | function achieveStuPushStream() { | 467 | function achieveStuPushStream() { |
| 415 | - $(".stuPublish").css("display","block"); | ||
| 416 | - $(".stuPlay").css("display","none"); | 468 | + |
| 417 | var paramInfo={ | 469 | var paramInfo={ |
| 418 | "type": "flash" | 470 | "type": "flash" |
| 419 | }; | 471 | }; |
| 420 | - var pubStuResult=client.getVideoPublishPath(paramInfo); | 472 | + pubStuResult=client.getVideoPublishPath(paramInfo); |
| 421 | 473 | ||
| 422 | console.log("执行getPublishVideoPath,返回的结果",pubStuResult); | 474 | console.log("执行getPublishVideoPath,返回的结果",pubStuResult); |
| 423 | 475 | ||
| @@ -432,6 +484,7 @@ function achieveStuPushStream() { | @@ -432,6 +484,7 @@ function achieveStuPushStream() { | ||
| 432 | if (error) { | 484 | if (error) { |
| 433 | return console.error(error); | 485 | return console.error(error); |
| 434 | } | 486 | } |
| 487 | + | ||
| 435 | window.publishStuflash = publishflash; | 488 | window.publishStuflash = publishflash; |
| 436 | window.publishflashStuVideoId = teaTimeStamp(); | 489 | window.publishflashStuVideoId = teaTimeStamp(); |
| 437 | 490 | ||
| @@ -442,7 +495,7 @@ function achieveStuPushStream() { | @@ -442,7 +495,7 @@ function achieveStuPushStream() { | ||
| 442 | console.log(' [stuPublish] native 2 js', msg); | 495 | console.log(' [stuPublish] native 2 js', msg); |
| 443 | var _msg=JSON.parse(msg); | 496 | var _msg=JSON.parse(msg); |
| 444 | console.log("_msg===========>",_msg); | 497 | console.log("_msg===========>",_msg); |
| 445 | - if(_msg.data.result == 0){ | 498 | + if((_msg.data.result == 0)&&(_msg.data.type==10)){ |
| 446 | //将之前底层取的推流结果传递给底层 | 499 | //将之前底层取的推流结果传递给底层 |
| 447 | var _successErrorResult= client.publishVideo(pubStuResult); | 500 | var _successErrorResult= client.publishVideo(pubStuResult); |
| 448 | console.log("_successErrorResult======>",_successErrorResult) | 501 | console.log("_successErrorResult======>",_successErrorResult) |
| @@ -453,7 +506,13 @@ function achieveStuPushStream() { | @@ -453,7 +506,13 @@ function achieveStuPushStream() { | ||
| 453 | console.log("底层广播推流失败,关闭推流"); | 506 | console.log("底层广播推流失败,关闭推流"); |
| 454 | } | 507 | } |
| 455 | 508 | ||
| 456 | - }else { | 509 | + }else if ((_msg.data.result == 0)&&(_msg.data.type==5)){ |
| 510 | + console.log("5,flash把学生视频流关闭成功"); | ||
| 511 | + | ||
| 512 | + | ||
| 513 | + } | ||
| 514 | + | ||
| 515 | + else { | ||
| 457 | console.error('stuPublish error'); | 516 | console.error('stuPublish error'); |
| 458 | } | 517 | } |
| 459 | } | 518 | } |
| @@ -495,10 +554,9 @@ function achieveStuPlayStream(_pubResultObj) { | @@ -495,10 +554,9 @@ function achieveStuPlayStream(_pubResultObj) { | ||
| 495 | }; | 554 | }; |
| 496 | var streamInfo=client.getVideoPlayPath(_paramInfo); | 555 | var streamInfo=client.getVideoPlayPath(_paramInfo); |
| 497 | console.log("result是=============>",streamInfo); | 556 | console.log("result是=============>",streamInfo); |
| 498 | - // $(".play").css("display","block"); | ||
| 499 | - $(".teacherVideoBg").css("display","none"); | ||
| 500 | - $(".teacherVideo").css("background", "#CCCCCC"); | ||
| 501 | - $(".teacherVideo-voice").css("bottom","4px"); | 557 | + $(".stuPlay").css({"width":"240px","height":"180px"}); |
| 558 | + $(".teacherVideo").css("background","#f5f9fb"); | ||
| 559 | + // $(".teacherVideoBg").css("display","block"); | ||
| 502 | 560 | ||
| 503 | if(! window.playflashStu) { | 561 | if(! window.playflashStu) { |
| 504 | flashvideo( | 562 | flashvideo( |
| @@ -516,6 +574,9 @@ function achieveStuPlayStream(_pubResultObj) { | @@ -516,6 +574,9 @@ function achieveStuPlayStream(_pubResultObj) { | ||
| 516 | }, | 574 | }, |
| 517 | function (msg) { | 575 | function (msg) { |
| 518 | console.log(' [play] native 2 js', msg); | 576 | console.log(' [play] native 2 js', msg); |
| 577 | + if ((msg.data.result == 0)&&(msg.data.type==5)){ | ||
| 578 | + console.log("5,flash把学生视频播放流关闭成功"); | ||
| 579 | + } | ||
| 519 | } | 580 | } |
| 520 | ) | 581 | ) |
| 521 | } | 582 | } |
| @@ -544,11 +605,11 @@ function achieveStuVoice() { | @@ -544,11 +605,11 @@ function achieveStuVoice() { | ||
| 544 | var paramInfo={ | 605 | var paramInfo={ |
| 545 | "type": "flash" | 606 | "type": "flash" |
| 546 | }; | 607 | }; |
| 547 | - var pubResult=client.getAudioPublishPath(paramInfo); | ||
| 548 | - console.log("执行getAudioPublishPath,返回的结果",pubResult); | 608 | + pubStuAudioResult=client.getAudioPublishPath(paramInfo); |
| 609 | + console.log("执行getAudioPublishPath,返回的结果",pubStuAudioResult); | ||
| 549 | 610 | ||
| 550 | //code为0,代表成功 | 611 | //code为0,代表成功 |
| 551 | - if (pubResult.code==0){ | 612 | + if (pubStuAudioResult.code==0){ |
| 552 | if(! window.publishflashStuVoice) { | 613 | if(! window.publishflashStuVoice) { |
| 553 | flashvideo( | 614 | flashvideo( |
| 554 | 'stuPublish', | 615 | 'stuPublish', |
| @@ -561,7 +622,7 @@ function achieveStuVoice() { | @@ -561,7 +622,7 @@ function achieveStuVoice() { | ||
| 561 | window.publishflashStuVoice = publishflash; | 622 | window.publishflashStuVoice = publishflash; |
| 562 | window.publishflashStuVoiceId = teaTimeStamp(); | 623 | window.publishflashStuVoiceId = teaTimeStamp(); |
| 563 | 624 | ||
| 564 | - publishStuVoiceURL(pubResult.publishUrl); | 625 | + publishStuVoiceURL(pubStuAudioResult.publishUrl); |
| 565 | }, | 626 | }, |
| 566 | function (msg) { | 627 | function (msg) { |
| 567 | 628 | ||
| @@ -571,7 +632,7 @@ function achieveStuVoice() { | @@ -571,7 +632,7 @@ function achieveStuVoice() { | ||
| 571 | if(_msg.data.result == 0){ | 632 | if(_msg.data.result == 0){ |
| 572 | 633 | ||
| 573 | //将之前底层取的推流结果传递给底层 | 634 | //将之前底层取的推流结果传递给底层 |
| 574 | - var _successErrorResult= client.publishAudio(pubResult); | 635 | + var _successErrorResult= client.publishAudio(pubStuAudioResult); |
| 575 | console.log("_successErrorResult======>",_successErrorResult) | 636 | console.log("_successErrorResult======>",_successErrorResult) |
| 576 | if(_successErrorResult.code==0){ | 637 | if(_successErrorResult.code==0){ |
| 577 | console.log("底层广播推流成功"); | 638 | console.log("底层广播推流成功"); |
| @@ -588,10 +649,10 @@ function achieveStuVoice() { | @@ -588,10 +649,10 @@ function achieveStuVoice() { | ||
| 588 | 649 | ||
| 589 | } | 650 | } |
| 590 | else { | 651 | else { |
| 591 | - publishStuVoiceURL(pubResult.publishUrl); | 652 | + publishStuVoiceURL(pubStuAudioResult.publishUrl); |
| 592 | } | 653 | } |
| 593 | 654 | ||
| 594 | - }else if(pubResult.code==1){ | 655 | + }else if(pubStuAudioResult.code==1){ |
| 595 | 656 | ||
| 596 | } | 657 | } |
| 597 | 658 | ||
| @@ -609,6 +670,62 @@ function publishStuVoiceURL(rtmpURL) { | @@ -609,6 +670,62 @@ function publishStuVoiceURL(rtmpURL) { | ||
| 609 | console.log(publishflashStuVoice._js2native(msg)); | 670 | console.log(publishflashStuVoice._js2native(msg)); |
| 610 | } | 671 | } |
| 611 | 672 | ||
| 673 | +//获取学生播音频地址 | ||
| 674 | +function achieveStuPlayAudioStream(_pubResultObj){ | ||
| 675 | + | ||
| 676 | + console.log("_pubResultObj==========>",_pubResultObj) | ||
| 677 | + var _paramInfo={ | ||
| 678 | + "type": "rtmp", | ||
| 679 | + "channelId": _pubResultObj.channelId,//频道号 | ||
| 680 | + "classId": _pubResultObj.classId,//课堂号 | ||
| 681 | + "siteId": _pubResultObj.siteId,//站点号 | ||
| 682 | + "timestamp":_pubResultObj.timestamp,//时间戳 | ||
| 683 | + "userId": _pubResultObj.userId,//userId | ||
| 684 | + }; | ||
| 685 | + var streamInfo=client.getAudioPlayPath(_paramInfo); | ||
| 686 | + console.log("result是=============>",streamInfo); | ||
| 687 | + $(".stuPlay").css({"width":"240px","height":"180px"}); | ||
| 688 | + $(".teacherVideoBg").css("display","none"); | ||
| 689 | + $(".teacherVideo").css("background", "#CCCCCC"); | ||
| 690 | + $(".teacherVideo-voice").css("bottom","4px"); | ||
| 691 | + | ||
| 692 | + if(! window.playflashStuAudio) { | ||
| 693 | + flashvideo( | ||
| 694 | + 'stuPlay', | ||
| 695 | + '100%', | ||
| 696 | + '100%', | ||
| 697 | + function createPlayReady(error, playflash) { | ||
| 698 | + if (error) { | ||
| 699 | + return console.error(error); | ||
| 700 | + } | ||
| 701 | + window.playflashStuAudio = playflash; | ||
| 702 | + window.playflashStuAudioId = teaTimeStamp(); | ||
| 703 | + | ||
| 704 | + stuPlayAudioURL(streamInfo.playUrl); | ||
| 705 | + }, | ||
| 706 | + function (msg) { | ||
| 707 | + console.log(' [play] native 2 js', msg); | ||
| 708 | + } | ||
| 709 | + ) | ||
| 710 | + } | ||
| 711 | + else { | ||
| 712 | + stuPlayAudioURL(streamInfo.playUrl); | ||
| 713 | + } | ||
| 714 | + | ||
| 715 | + | ||
| 716 | +} | ||
| 717 | + | ||
| 718 | +function stuPlayAudioURL(rtmpURL){ | ||
| 719 | + const msg = JSON.stringify({ | ||
| 720 | + type: 2, | ||
| 721 | + videoId: playflashStuAudioId, | ||
| 722 | + data: { | ||
| 723 | + url: rtmpURL | ||
| 724 | + // url:'rtmp://123.56.205.116:1935/live/alexwang' | ||
| 725 | + } | ||
| 726 | + }); | ||
| 727 | + console.log(playflashStuAudio._js2native(msg)); | ||
| 728 | +} | ||
| 612 | 729 | ||
| 613 | 730 | ||
| 614 | //获取老师只推音频 | 731 | //获取老师只推音频 |
| @@ -682,12 +799,10 @@ function publishTeaAudioURL(rtmpURL) { | @@ -682,12 +799,10 @@ function publishTeaAudioURL(rtmpURL) { | ||
| 682 | console.log(publishflashAudio._js2native(msg)); | 799 | console.log(publishflashAudio._js2native(msg)); |
| 683 | } | 800 | } |
| 684 | 801 | ||
| 685 | - | ||
| 686 | - | ||
| 687 | //获取老师推流音视频地址 | 802 | //获取老师推流音视频地址 |
| 688 | function achieveTeaVideoStream(){ | 803 | function achieveTeaVideoStream(){ |
| 689 | $(".publish").css({"width":"240px","height":"180px"}); | 804 | $(".publish").css({"width":"240px","height":"180px"}); |
| 690 | - $(".play").css("display","none"); | 805 | + $(".play").css({"width":"1px","height":"1px"}); |
| 691 | var paramInfo={ | 806 | var paramInfo={ |
| 692 | "type": "flash" | 807 | "type": "flash" |
| 693 | }; | 808 | }; |
| @@ -829,7 +944,6 @@ function playAudioURL(rtmpURL){ | @@ -829,7 +944,6 @@ function playAudioURL(rtmpURL){ | ||
| 829 | console.log("result是=============>",streamInfo); | 944 | console.log("result是=============>",streamInfo); |
| 830 | $(".play").css({"width":"240px","height":"180px"}); | 945 | $(".play").css({"width":"240px","height":"180px"}); |
| 831 | $(".teacherVideoBg").css("display","none"); | 946 | $(".teacherVideoBg").css("display","none"); |
| 832 | - $(".teacherVideo").css("background", "#CCCCCC"); | ||
| 833 | $(".teacherVideo-voice").css("bottom","4px"); | 947 | $(".teacherVideo-voice").css("bottom","4px"); |
| 834 | 948 | ||
| 835 | if(! window.playflash) { | 949 | if(! window.playflash) { |
-
请 注册 或 登录 后发表评论