李勇

1.增加音频AudioApe模块,增加音频模块的pdu

2.修改视频模块和音频模块对外接口的名称
@@ -11,6 +11,7 @@ import Loger from 'Loger'; @@ -11,6 +11,7 @@ import Loger from 'Loger';
11 import ConferApe from 'apes/ConferApe'; 11 import ConferApe from 'apes/ConferApe';
12 import ChatApe from 'apes/ChatApe'; 12 import ChatApe from 'apes/ChatApe';
13 import VideoApe from 'apes/VideoApe'; 13 import VideoApe from 'apes/VideoApe';
  14 +import AudioApe from 'apes/AudioApe';
14 import DocApe from 'apes/DocApe'; 15 import DocApe from 'apes/DocApe';
15 import WhiteBoardApe from 'apes/WhiteBoardApe'; 16 import WhiteBoardApe from 'apes/WhiteBoardApe';
16 import EngineUtils from "EngineUtils"; 17 import EngineUtils from "EngineUtils";
@@ -29,6 +30,7 @@ let _mcu ; @@ -29,6 +30,7 @@ let _mcu ;
29 let _confer_ape; 30 let _confer_ape;
30 let _chat_ape; 31 let _chat_ape;
31 let _video_ape; 32 let _video_ape;
  33 +let _audio_ape;
32 let _doc_ape; 34 let _doc_ape;
33 let _whiteboard_ape; 35 let _whiteboard_ape;
34 36
@@ -87,6 +89,10 @@ export default class MessageEntrance extends Emiter { @@ -87,6 +89,10 @@ export default class MessageEntrance extends Emiter {
87 _video_ape.on('*', (type, data) => this._emit(type, data)); 89 _video_ape.on('*', (type, data) => this._emit(type, data));
88 _video_ape.on(MessageTypes.VIDEO_UPDATE, this.videoUpdate.bind(this)); 90 _video_ape.on(MessageTypes.VIDEO_UPDATE, this.videoUpdate.bind(this));
89 91
  92 + _audio_ape= new AudioApe();
  93 + _audio_ape.on('*', (type, data) => this._emit(type, data));
  94 + _audio_ape.on(MessageTypes.AUDIO_UPDATE, this.videoUpdate.bind(this));
  95 +
90 _whiteboard_ape = new WhiteBoardApe(); 96 _whiteboard_ape = new WhiteBoardApe();
91 _whiteboard_ape.on('*', (type, data) => this._emit(type, data)); 97 _whiteboard_ape.on('*', (type, data) => this._emit(type, data));
92 //_whiteboard_ape.on(MessageTypes.WHITEBOARD_ANNOTATION_UPDATE, this.annoUpdateHandler.bind(this)); 98 //_whiteboard_ape.on(MessageTypes.WHITEBOARD_ANNOTATION_UPDATE, this.annoUpdateHandler.bind(this));
@@ -115,12 +121,19 @@ export default class MessageEntrance extends Emiter { @@ -115,12 +121,19 @@ export default class MessageEntrance extends Emiter {
115 this.sendChatMsg = this._sendChatMsg; 121 this.sendChatMsg = this._sendChatMsg;
116 122
117 //videoApe 123 //videoApe
118 - this.getPlayVideoPath = this._getPlayVideoPath;  
119 - this.getPublishVideoPath = this._getPublishVideoPath; 124 + this.getVideoPlayPath = this._getPlayVideoPath;
  125 + this.getVideoPublishPath = this._getPublishVideoPath;
120 this.publishVideo = this._publishVideo; 126 this.publishVideo = this._publishVideo;
121 this.stopPublishVideo = this._stopPublishVideo; 127 this.stopPublishVideo = this._stopPublishVideo;
122 - this.sendVideoCommandMsg=this.sendVideoCommandMsg; 128 + this.sendVideoBroadcastMsg=this.sendVideoCommandMsg;
  129 +
123 130
  131 + //audioApe
  132 + this.getAudioPlayPath = this._getPlayAudioPath;
  133 + this.getAudioPublishPath = this._getPublishAudioPath;
  134 + this.publishAudio = this._publishAudio;
  135 + this.stopPublishAudio = this._stopPublishAudio;
  136 + this.sendAudioBroadcastMsg=this.sendAudioCommandMsg;
124 137
125 //whiteBoradApe 138 //whiteBoradApe
126 this.sendInsertAnnotaion = this._sendInsertAnnotaion; 139 this.sendInsertAnnotaion = this._sendInsertAnnotaion;
@@ -184,6 +197,9 @@ export default class MessageEntrance extends Emiter { @@ -184,6 +197,9 @@ export default class MessageEntrance extends Emiter {
184 if(_video_ape){ 197 if(_video_ape){
185 _video_ape.stopPublishVideo(_data); 198 _video_ape.stopPublishVideo(_data);
186 } 199 }
  200 + if(_audio_ape){
  201 + _video_ape.stopPublishAudio(_data);
  202 + }
187 } 203 }
188 } 204 }
189 205
@@ -197,6 +213,9 @@ export default class MessageEntrance extends Emiter { @@ -197,6 +213,9 @@ export default class MessageEntrance extends Emiter {
197 if(_video_ape){ 213 if(_video_ape){
198 _video_ape.stopPublishVideo({"nodeId":_param.fromNodeId}); 214 _video_ape.stopPublishVideo({"nodeId":_param.fromNodeId});
199 } 215 }
  216 + if(_audio_ape){
  217 + _audio_ape.stopPublishAudio({"nodeId":_param.fromNodeId});
  218 + }
200 } 219 }
201 220
202 221
@@ -653,6 +672,9 @@ export default class MessageEntrance extends Emiter { @@ -653,6 +672,9 @@ export default class MessageEntrance extends Emiter {
653 if(_video_ape){ 672 if(_video_ape){
654 _video_ape.stopPublishVideo(); 673 _video_ape.stopPublishVideo();
655 } 674 }
  675 + if(_audio_ape){
  676 + _audio_ape.stopPublishAudio();
  677 + }
656 //离开会议 678 //离开会议
657 if(_confer_ape){ 679 if(_confer_ape){
658 _confer_ape.leaveClass(); 680 _confer_ape.leaveClass();
@@ -714,6 +736,45 @@ export default class MessageEntrance extends Emiter { @@ -714,6 +736,45 @@ export default class MessageEntrance extends Emiter {
714 } 736 }
715 } 737 }
716 738
  739 + //AudioApe
  740 + audioUpdate(_data){
  741 + //视频同步的消息发送改变,需要通知ferApe模块中的用户更新状态
  742 + if(_confer_ape){
  743 + _confer_ape.updaterRosterStatus(_data);
  744 + }
  745 + }
  746 +
  747 + sendAudioCommandMsg(_param){
  748 + if(_audio_ape){
  749 + return _audio_ape.sendAudioBroadcastMsg(_param);
  750 + }
  751 + }
  752 +
  753 + _getPlayAudioPath(_param){
  754 + if(_audio_ape){
  755 + return _audio_ape.getAudioPlayPath(_param);
  756 + }
  757 + }
  758 +
  759 + _getPublishAudioPath(_param){
  760 + if(_audio_ape){
  761 + return _audio_ape.getAudioPublishPath(_param);
  762 + }
  763 + }
  764 +
  765 + _publishAudio(_param){
  766 + if(_audio_ape){
  767 + return _audio_ape.publishAudio(_param);
  768 + }
  769 + }
  770 +
  771 + _stopPublishAudio(_param){
  772 + if(_audio_ape){
  773 + return _audio_ape.stopPublishAudio(_param);
  774 + }
  775 + }
  776 +
  777 +
717 //WhiteBoardApe 778 //WhiteBoardApe
718 // 添加标注,发送信息 779 // 添加标注,发送信息
719 _sendInsertAnnotaion(_param){ 780 _sendInsertAnnotaion(_param){
@@ -31,6 +31,11 @@ MessageTypes.CHAT_RECEIVE = 'chat.receive'; @@ -31,6 +31,11 @@ MessageTypes.CHAT_RECEIVE = 'chat.receive';
31 MessageTypes.VIDEO_UPDATE = 'video.update'; 31 MessageTypes.VIDEO_UPDATE = 'video.update';
32 MessageTypes.VIDEO_COMMAND= 'video.command'; 32 MessageTypes.VIDEO_COMMAND= 'video.command';
33 33
  34 +//音频模块事件定义
  35 +MessageTypes.AUDIO_UPDATE = 'audio.update';
  36 +MessageTypes.AUDIO_COMMAND= 'audio.command';
  37 +
  38 +
34 //文档模块事件定义 39 //文档模块事件定义
35 MessageTypes.DOC_DELETE='document.delete';//删除文档 40 MessageTypes.DOC_DELETE='document.delete';//删除文档
36 MessageTypes.DOC_UPDATE = 'document.update';//更新文档(添加、变更) 41 MessageTypes.DOC_UPDATE = 'document.update';//更新文档(添加、变更)
@@ -21,9 +21,9 @@ import MessageTypes from 'MessageTypes'; @@ -21,9 +21,9 @@ import MessageTypes from 'MessageTypes';
21 import GlobalConfig from 'GlobalConfig'; 21 import GlobalConfig from 'GlobalConfig';
22 import EngineUtils from 'EngineUtils'; 22 import EngineUtils from 'EngineUtils';
23 23
24 -let loger = Loger.getLoger('VideoChat'); 24 +let loger = Loger.getLoger('VideoApe');
25 25
26 -class VideoChat extends Ape { 26 +class VideoApe extends Ape {
27 constructor() { 27 constructor() {
28 super( 28 super(
29 ApeConsts.VIDEO_SESSION_ID, 29 ApeConsts.VIDEO_SESSION_ID,
@@ -451,5 +451,5 @@ class VideoChat extends Ape { @@ -451,5 +451,5 @@ class VideoChat extends Ape {
451 } 451 }
452 } 452 }
453 453
454 -export default VideoChat; 454 +export default VideoApe;
455 455
@@ -740,10 +740,16 @@ message RCGiftSendDataRequestPdu { @@ -740,10 +740,16 @@ message RCGiftSendDataRequestPdu {
740 optional bytes user_data = 5; 740 optional bytes user_data = 5;
741 } 741 }
742 742
743 -message RCAudioSendDataRequestPdu { 743 +message RCAudioSendDataRequestPdu1 {
744 optional uint32 initiator = 1; 744 optional uint32 initiator = 1;
745 required bytes user_data = 2; 745 required bytes user_data = 2;
746 } 746 }
  747 +message RCAudioSendDataRequestPdu {
  748 + required uint32 from_node_id = 1;//发起人
  749 + optional uint32 to_node_id = 2;//接收人,如果是0就是所有人都接收
  750 + optional uint32 actionType = 3;//消息指令类型;
  751 + optional bytes data = 4;//其他数据,这个根据actionType来确定数据的结构
  752 +}
747 753
748 message RCVideoSendDataRequestPdu { 754 message RCVideoSendDataRequestPdu {
749 required uint32 from_node_id = 1;//发起人 755 required uint32 from_node_id = 1;//发起人
@@ -759,6 +765,17 @@ message RCAudioChannelInfoRecordPdu { @@ -759,6 +765,17 @@ message RCAudioChannelInfoRecordPdu {
759 required uint32 bitrate = 4; 765 required uint32 bitrate = 4;
760 required uint32 codec = 5; 766 required uint32 codec = 5;
761 } 767 }
  768 +message RCAudioChannelInfoPdu {
  769 + optional uint32 status = 1;//开启的状态
  770 + optional uint32 channel_id = 2;//唯一的频道id
  771 + optional uint32 timestamp = 3;//更新的时间戳
  772 + optional uint32 from_node_id = 4;//发起者的id
  773 + optional uint32 to_node_id = 5;//接收者的id,(如果是0,所有人都接收)
  774 + optional uint32 media_type = 6;//媒体类型:视频(包含音频)或音频
  775 + optional uint32 class_id = 7;//课堂号
  776 + optional string site_id = 8;//站点号
  777 + optional string user_id = 9;//用户的userId
  778 +}
762 779
763 message RCVideoChannelInfoPdu { 780 message RCVideoChannelInfoPdu {
764 optional uint32 status = 1;//开启的状态 781 optional uint32 status = 1;//开启的状态