| 
					
				 | 
			
			
				@@ -1,3 +1,5 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { Message } from 'element-ui'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @description WebSDK 实例化对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -15,22 +17,6 @@ export function initSDK(data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * @method startLive 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * @description 开启直播 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-export function startLive() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  rtc.startLive({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    success(data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      alert('开启直播成功'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    fail(data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      alert(`开启直播失败:${data}`); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @method publishStream 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @description 推送本地流 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -39,17 +25,17 @@ export function publishStream() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     streamName: 'main', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 推流成功,更新上麦结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     success: function (stream) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(stream); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // rtc.updateMcResult({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //   pid: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //   stid: stream.id(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //   success: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //     alert('更新上麦结果请求成功,此处可处理应用层逻辑' + JSON.stringify(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //   fail: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //     alert('更新上麦结果请求失败,此处可处理应用层逻辑' + JSON.stringify(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log('推流成功', stream); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      rtc.updateMcResult({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pid: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        stid: stream.id(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        success: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          console.log('更新上麦结果请求成功,此处可处理应用层逻辑', data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        fail: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          alert('更新上麦结果请求失败:' + JSON.stringify(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     fail: function (str) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 推流失败,更新上麦结果 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -59,6 +45,29 @@ export function publishStream() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @method startLive 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @description 开启直播 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+export function startLive() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  rtc.startLive({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    success(data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      publishStream(); // 如果需要立即推流,执行 publish 方法 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      Message({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        message: '开启直播成功', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        type: 'success' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fail(data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      Message({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        message: `开启直播失败:${data}`, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        type: 'warning' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @method createLocalStram 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @description 创建本地流 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -75,7 +84,6 @@ export function createLocalStream() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 创建本地流成功,将流展示到id为 live 的dom元素盒子中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       stream.show('live'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       startLive(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      publishStream(stream); // 如果需要立即推流,执行 publish 方法 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     fail: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 创建本地流失败,应用层处理 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -92,12 +100,30 @@ export function createLocalStream() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export function initListener(vue) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   rtc.on('login_success', data => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log('登录成功', data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Message({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      message: '登录成功', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'success' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     vue.roomData = data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let canvasInitData = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      allowDraw: true, // 是否具有书写画笔权限(讲师权限) true / false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      id: 'draw-parent', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      pptDisplay: 0 // 文档展示方式。默认0,按窗口  1, 按宽度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 如果直播已经开始,需将直播id传入sdk中, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (data.live.status === 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      canvasInitData.liveId = data.live.id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 初始化画板 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    rtc.canvasInit(canvasInitData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   rtc.on('login_failed', data => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log('登录失败', data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    alert('登录失败:' + JSON.stringify(data)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Message({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      message: '登录失败:' + JSON.stringify(data), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'warning' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // 必须在加入房间成功的“conference_join”事件回调里创建本地流 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -113,15 +139,24 @@ export function initListener(vue) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // 房间全量信息事件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   rtc.on('room_context', roomData => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log(JSON.parse(roomData)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    vue.roomContext = JSON.parse(roomData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('房间全量信息事件', JSON.parse(roomData)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   rtc.on('publish_stream', str => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log('直播已开启', str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Message({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      message: '直播已开启', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'success' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   rtc.on('end_stream', str => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log('直播已关闭', str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Message({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      message: '直播已关闭', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      type: 'success' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   rtc.on('switch_user_settings', settingData => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -129,8 +164,9 @@ export function initListener(vue) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log(settingData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // 人员列表事件(人员麦序变化时广播) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   rtc.on('speak_context', speakData => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log(speakData); // 人员列表事件(人员麦序变化时广播) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    vue.speakData = JSON.parse(speakData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   rtc.on('switch_settings', data => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -138,7 +174,7 @@ export function initListener(vue) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   rtc.on('allow_sub', stream => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    alert('监听到有流'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log('监听到有流'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rtc.trySubscribeStream({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       tryStream: stream, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       success: function success(stream) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -289,6 +325,20 @@ export function getLiveStat() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @description 推送桌面共享 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+export function publishShareStream() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  rtc.publishShareStream({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    success: function (stream) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log('推送桌面共享成功', stream); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fail: function (str) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log(str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @description 开启、结束、暂停、恢复录制 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @param { String } status: 'start' 开启, 'end' 结束, 'pause' 暂停, 'resume' 恢复 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -304,6 +354,42 @@ export function liveRecord(status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 排麦 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @description 老师端发起邀请,邀请学生上麦。(举手模式) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @param {String} uid 被邀请用户id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+export function invite(uid) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  rtc.invite({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    uid: uid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    success: function (str) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log('邀请上麦成功', str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fail: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      Message({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        type: 'error', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        message: `邀请上麦失败:${data.errorMsg}` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @description 学生端接受老师的上麦邀请,同意上麦 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+export function inviteAccept() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  rtc.inviteAccept({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    success: function (str) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log('接受邀请成功', str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fail: function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log('接受邀请失败', data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 聊天组件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -314,6 +400,10 @@ export function sendMsg(msg) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   rtc.sendMsg(msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-export function roomUpdate() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  rtc.roomUpdate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @description 房间配置项更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @param {Object} option 房间配置项 (具体看2.0 https://doc.bokecc.com/class/developer/web/chat.html),以键值对的形式传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+export function roomUpdate(option) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  rtc.roomUpdate(option); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |