ITMG_MAIN_EVNET_TYPE_ROOM_MANAGEMENT_OPERATOR
回调,回调详情请参考 回调处理。类型 | 接口 |
控制采集 | EnableMic、 EnableAudioCaptureDevice、EnableAudioSend |
控制播放 | EnableSpeaker、 EnableAudioPlayDevice、EnableAudioRecv |
设备状态获取 | GetMicState、 GetSpeakerState |
敏感接口 | ForbidUserOperation |
public abstract int EnableMic(boolean isEnabled,String receiverID);
-(QAVResult)EnableMic:(BOOL)enable Receiver:(NSString *)receiverID;
参数 | 类型 | 含义 |
enable | BOOL | YES:打开某用户麦克风,NO:关闭某用户麦克风 |
receiverID | NSString* | 填入目标用户 OpenId |
public abstract int EnableAudioSend(boolean isEnabled,String receiverID);
-(QAVResult)EnableAudioSend:(BOOL)enable Receiver:(NSString *)receiverID;
参数 | 类型 | 含义 |
enable | BOOL | YES:打开某用户上行,NO:关闭某用户上行 |
receiverID | NSString* | 填入目标用户 OpenId |
public abstract int EnableAudioCaptureDevice(boolean isEnabled,String receiverID);
-(QAVResult)EnableAudioCaptureDevice:(BOOL)enabled Receiver:(NSString *)receiverID;
参数 | 类型 | 含义 |
enable | BOOL | YES:打开某用户音频采集硬件设备,NO:关闭某用户音频采集硬件设备 |
receiverID | NSString* | 填入目标用户 OpenId |
public abstract int EnableSpeaker(boolean isEnabled,String receiverID);
-(QAVResult)EnableSpeaker:(BOOL)enable Receiver:(NSString *)receiverID;
参数 | 类型 | 含义 |
enable | BOOL | YES :打开某用户扬声器,NO:关闭某用户扬声器 |
receiverID | NSString* | 填入目标用户 OpenId |
public abstract int EnableAudioRecv(boolean isEnabled,String receiverID);
-(QAVResult)EnableAudioRecv:(BOOL)enabled Receiver:(NSString *)receiverID;
参数 | 类型 | 含义 |
enable | BOOL | YES :打开某用户音频下行,NO:关闭某用户音频下行 |
receiverID | NSString* | 填入目标用户 OpenId |
public abstract int EnableAudioPlayDevice(boolean isEnabled,String receiverID);
-(QAVResult)EnableAudioPlayDevice:(BOOL)enabled Receiver:(NSString *)receiverID;
参数 | 类型 | 含义 |
enable | BOOL | YES :打开某用户音频播放硬件设备,NO:关闭某用户音频播放硬件设备 |
receiverID | NSString* | 填入目标用户 OpenId |
public abstract int GetMicState(String receiverID);
-(QAVResult)GetMicState:(NSString *)receiverID;
参数 | 类型 | 含义 |
receiverID | NSString* | 填入目标用户 OpenId |
public abstract int GetSpeakerState(String receiverID);
-(QAVResult)GetSpeakerState:(NSString *)receiverID;
public abstract int ForbidUserOperation(boolean isEnabled,String receiverID);
-(QAVResult)ForbidUserOperation:(BOOL)enable Receiver:(NSString *)receiverID;
参数 | 类型 | 含义 |
enable | BOOL | YES:禁止某用户操作设备,NO:允许某用户操作设备 |
receiverID | NSString* | 填入目标用户 OpenId |
ITMG_MAIN_EVNET_TYPE_ROOM_MANAGEMENT_OPERATOR
,事件会返回一个结构体,具体包含的内容如下。参数 | 类型 | 含义 |
SenderID | NSString | 事件发送者 ID,如果与自己 OpenId 相同,即为本端发送的命令 |
ReceiverID | NSString | 事件接收者 ID,如果与自己 OpenId 相同,即为本端接收的命令 |
OperateType | NSNumber | 事件类型 |
Result | NSNumber | 事件结果,0为成功 |
OperateValue | NSNumber | 命令详情 |
数值 | 事件类型 | 含义 |
0 | ITMG_ROOM_MANAGEMENT_CAPTURE_OP | 控制采集设备硬件回调 |
1 | ITMG_ROOM_MANAGEMENT_PLAY_OP | 控制播放设备硬件回调 |
2 | ITMG_ROOM_MANAGEMENT_AUDIO_SEND_OP | 控制上行回调 |
3 | ITMG_ROOM_MANAGEMENT_AUDIO_REC_OP | 控制下行回调 |
4 | ITMG_ROOM_MANAGEMENT_MIC_OP | 控制麦克风回调 |
5 | ITMG_ROOM_MANAGEMENT_PLAY_OP | 控制扬声器回调 |
6 | ITMG_ROOM_MANAGEMENT_GET_MIC_STATE | 获取麦克风状态 |
7 | ITMG_ROOM_MANAGEMENT_GET_SPEAKER_STATE | 获取扬声器状态 |
8 | ITMG_ROOM_MANAGERMENT_FOBIN_OP | 禁止操作麦克风及扬声器事件 |
成员 | 含义 |
boolValue | 0:关闭命令,1:打开命令 |
public void OnEvent(ITMGContext.ITMG_MAIN_EVENT_TYPE type, Intent data) {if (ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVNET_TYPE_ROOM_MANAGEMENT_OPERATOR== type) {ArrayList<String> operatorArr = new ArrayList<String>();operatorArr.add("采集");operatorArr.add("播放");operatorArr.add("上行");operatorArr.add("下行");operatorArr.add("采集上行");operatorArr.add("播放下行");operatorArr.add("mic状态");operatorArr.add("spk状态");operatorArr.add("禁止操作mic/speak");String SenderID = data.getStringExtra("SenderID");String ReceiverID = data.getStringExtra("ReceiverID");int OperateType = data.getIntExtra("OperateType",-1000);int Result =data.getIntExtra("Result",-1000);boolean OperateValue = data.getBooleanExtra("OperateValue",false);if (OperateType == -1000 ||Result == -1000) {return;}if (SenderID.equals(identifier)) {if (OperateType == ITMGContext.ITMG_ROOM_MANAGEMENT_GET_MIC_STATE || OperateType == ITMGContext.ITMG_ROOM_MANAGEMENT_GET_SPEAKER_STATE) {Toast.makeText(getActivity(), String.format("发送给id:%s 的%s操作,结果:%s", ReceiverID, operatorArr.get(OperateType), OperateValue ? "开" : "关"), Toast.LENGTH_LONG).show();} else {Toast.makeText(getActivity(), String.format("发送给id:%s 的%s%s操作,结果:%d", ReceiverID, operatorArr.get(OperateType), OperateValue ? "开" : "关", Result), Toast.LENGTH_LONG).show();}} else if (ReceiverID.equals(identifier)||ReceiverID.equals("ALL")) {if (Result == 0) {switch (OperateType) {case ITMGContext.ITMG_ROOM_MANAGEMENT_CAPTURE_OP:{if (!OperateValue) {mSwitchCapture.setChecked(OperateValue);} else {AlertDialog.Builder dialog = new AlertDialog.Builder (getActivity()); //创建对象dialog.setTitle("是否要打开设备采集");dialog.setMessage("");dialog.setCancelable(false);dialog.setPositiveButton("开", new DialogInterface.OnClickListener() {//设置确定按钮的点击事件@Overridepublic void onClick(DialogInterface dialog, int which) {mSwitchCapture.setChecked(true);ITMGContext.GetInstance(getActivity()).GetAudioCtrl().EnableAudioCaptureDevice(true);}});dialog.setNegativeButton("关", new DialogInterface.OnClickListener() {//设置取消按钮的点击事件@Overridepublic void onClick(DialogInterface dialog, int which) {}});dialog.show();}}break;case ITMGContext.ITMG_ROOM_MANAGEMENT_PLAY_OP:{mSwitchPlayDevice.setChecked(OperateValue);}break;case ITMGContext.ITMG_ROOM_MANAGEMENT_AUDIO_SEND_OP:{if (!OperateValue) {mSwitchSend.setChecked(OperateValue);} else {AlertDialog.Builder dialog = new AlertDialog.Builder (getActivity()); //创建对象dialog.setTitle("是否要打开上行");dialog.setMessage("");dialog.setCancelable(false);dialog.setPositiveButton("开", new DialogInterface.OnClickListener() {//设置确定按钮的点击事件@Overridepublic void onClick(DialogInterface dialog, int which) {mSwitchSend.setChecked(true);ITMGContext.GetInstance(getActivity()).GetAudioCtrl().EnableAudioSend(true);}});dialog.setNegativeButton("关", new DialogInterface.OnClickListener() {//设置取消按钮的点击事件@Overridepublic void onClick(DialogInterface dialog, int which) {}});dialog.show();}}break;case ITMGContext.ITMG_ROOM_MANAGEMENT_AUDIO_REC_OP:{mSwitchRecv.setChecked(OperateValue);}break;case ITMGContext.ITMG_ROOM_MANAGEMENT_MIC_OP:{if (!OperateValue) {mSwitchCapture.setChecked(OperateValue);mSwitchSend.setChecked(OperateValue);} else {AlertDialog.Builder dialog = new AlertDialog.Builder (getActivity()); //创建对象dialog.setTitle("是否要打开采集和上行");dialog.setMessage("");dialog.setCancelable(false);dialog.setPositiveButton("开", new DialogInterface.OnClickListener() {//设置确定按钮的点击事件@Overridepublic void onClick(DialogInterface dialog, int which) {mSwitchCapture.setChecked(true);mSwitchSend.setChecked(true);ITMGContext.GetInstance(getActivity()).GetAudioCtrl().EnableMic(true);}});dialog.setNegativeButton("关", new DialogInterface.OnClickListener() {//设置取消按钮的点击事件@Overridepublic void onClick(DialogInterface dialog, int which) {}});dialog.show();}}break;case ITMGContext.ITMG_ROOM_MANAGEMENT_SPEAKER_OP:{mSwitchPlayDevice.setChecked(OperateValue);mSwitchRecv.setChecked(OperateValue);}break;}}if (OperateType == ITMGContext.ITMG_ROOM_MANAGEMENT_GET_MIC_STATE || OperateType == ITMGContext.ITMG_ROOM_MANAGEMENT_GET_SPEAKER_STATE){Toast.makeText(getActivity(), String.format("收到来自id:%s 的%s操作,结果:%s",SenderID,operatorArr.get(OperateType),OperateValue?"开":"关"), Toast.LENGTH_LONG).show();}else if (OperateType == ITMGContext.ITMG_ROOM_MANAGEMENT_SPEAKER_OP || OperateType == ITMGContext.ITMG_ROOM_MANAGEMENT_AUDIO_REC_OP|| OperateType == ITMGContext.ITMG_ROOM_MANAGEMENT_PLAY_OP|| OperateType == ITMGContext.ITMG_ROOM_MANAGERMENT_FOBIN_OP){Toast.makeText(getActivity(), String.format("收到来自id:%s 的%s%s操作,结果:%d",SenderID,operatorArr.get(OperateType),OperateValue?"开":"关",Result), Toast.LENGTH_LONG).show();} else if (OperateValue == false) {Toast.makeText(getActivity(), String.format("收到来自id:%s 的%s%s操作,结果:%d",SenderID,operatorArr.get(OperateType),OperateValue?"开":"关",Result), Toast.LENGTH_LONG).show();}}}
-(void)OnEvent:(ITMG_MAIN_EVENT_TYPE)eventType data:(NSDictionary *)data{NSString* log =[NSString stringWithFormat:@"OnEvent:%d,data:%@", (int)eventType, data];[self showLog:log];NSLog(@"====%@====",log);switch (eventType) {case ITMG_MAIN_EVNET_TYPE_ROOM_MANAGEMENT_OPERATOR:{NSArray *operatorArr = @[@"采集",@"播放",@"上行",@"下行",@"采集上行",@"播放下行",@"踢人",@"mic状态",@"spk状态",@"禁止操作mic/speak"];// _openIdNSString *SenderID = [data objectForKey:@"SenderID"];NSString *ReceiverID = [data objectForKey:@"ReceiverID"];NSNumber *OperateType = [data objectForKey:@"OperateType"];NSNumber *Result = [data objectForKey:@"Result"];NSNumber *OperateValue = [data objectForKey:@"OperateValue"];//自己发出去的命令if ([SenderID isEqualToString:_openId]) {if (OperateType.intValue == ITMG_ROOM_MANAGEMENT_GET_MIC_STATE || OperateType.intValue == ITMG_ROOM_MANAGEMENT_GET_SPEAKER_STATE) {NSString *alterString = [NSString stringWithFormat:@"发送给id:%@ 的%@操作,结果:%@",ReceiverID,operatorArr[OperateType.intValue],OperateValue.boolValue?@"开":@"关"];UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"房间管理操作" message:alterString delegate:NULL cancelButtonTitle:@"OK" otherButtonTitles:nil];[alert show];}else{NSString *alterString = [NSString stringWithFormat:@"发送给id:%@ 的%@%@操作,结果:%@",ReceiverID,OperateValue.boolValue?@"开":@"关",operatorArr[OperateType.intValue],Result];UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"房间管理操作" message:alterString delegate:NULL cancelButtonTitle:@"OK" otherButtonTitles:nil];[alert show];}}else if([ReceiverID isEqualToString:_openId] ){ //别人发过来的命令if (Result.intValue == 0) {switch (OperateType.intValue) {case ITMG_ROOM_MANAGEMENT_CAPTURE_OP:{[_micSwitch setOn:OperateValue.boolValue animated:true];}break;case ITMG_ROOM_MANAGEMENT_PLAY_OP:{[_speakerSwitch setOn:OperateValue.boolValue animated:true];}break;case ITMG_ROOM_MANAGEMENT_AUDIO_SEND_OP:{[_sendSwitch setOn:OperateValue.boolValue animated:true];}break;case ITMG_ROOM_MANAGEMENT_AUDIO_REC_OP:{[_recvSwitch setOn:OperateValue.boolValue animated:true];}break;case ITMG_ROOM_MANAGEMENT_MIC_OP:{[_micSwitch setOn:OperateValue.boolValue animated:true];[_sendSwitch setOn:OperateValue.boolValue animated:true];}break;case ITMG_ROOM_MANAGEMENT_SPEAKER_OP:{[_speakerSwitch setOn:OperateValue.boolValue animated:true];[_recvSwitch setOn:OperateValue.boolValue animated:true];}break;default:break;}if (OperateType.intValue == ITMG_ROOM_MANAGEMENT_GET_MIC_STATE || OperateType.intValue == ITMG_ROOM_MANAGEMENT_GET_SPEAKER_STATE) {NSString *alterString = [NSString stringWithFormat:@"收到id:%@ 发送来的%@操作,结果:%@",SenderID,operatorArr[OperateType.intValue],OperateValue.boolValue?@"开":@"关"];UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"房间管理操作" message:alterString delegate:NULL cancelButtonTitle:@"OK" otherButtonTitles:nil];[alert show];}else{NSString *alterString = [NSString stringWithFormat:@"收到id:%@ 发送来的%@%@操作,结果:%@",SenderID,OperateValue.boolValue?@"开":@"关",operatorArr[OperateType.intValue],Result];UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"房间管理操作" message:alterString delegate:NULL cancelButtonTitle:@"OK" otherButtonTitles:nil];[alert show];}}}}break;}
本页内容是否解决了您的问题?