Overview
Strengths
Features
Scenarios
Compliance
ITMG_ROOM_TYPE_STANDARD or ITMG_ROOM_TYPE_HIGHQUALITY); the mic of the sender and the speaker of the receiver are both on.-(int) SendCustomData:(NSData *)data repeatCout:(int)reaptCout;
public abstract int SendCustomData(byte[] data,int repeatCout);
public abstract int SendCustomData(byte[] customdata,int repeatCout);
Parameter | Type | Description |
data | NSData * or byte[] | Message to be delivered |
reaptCout | int | Number of repeat times. -1 indicates to send the message repeatedly for unlimited times. |
-(IBAction)SendCustData:(UIButton*)sender {int ret = 0;NSString *typeString;switch (sender.tag) {case 1:ret = [[[ITMGContext GetInstance] GetRoom] SendCustomData:[NSData dataWithBytes:_shareRoomID.text.UTF8String length:_roomIdText.text.length] repeatCout:_shareOpenID.text.intValue];typeString = @"sendCustData";break;case 2:ret = [[[ITMGContext GetInstance] GetRoom] StopSendCustomData];typeString = @"recvCustData";break;default:break;}if(ret != 0){UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"set fail" message:[NSString stringWithFormat:@"%@:errorcode :%d",typeString,ret] delegate:NULL cancelButtonTitle:@"OK" otherButtonTitles:nil];[alert show];}}
String strData = mEditData.getText().toString();String repeatCount = mEditRepeatCount.getText().toString();int nRet = ITMGContext.GetInstance(getActivity()).GetRoom().SendCustomData(strData.getBytes(), Integer.parseInt(repeatCount));
InputField SendCustom_Count_InputField = transform.Find("inroomPanel/imPanel/SendCustom_Count_InputField").GetComponent<InputField>();InputField SendCustom_Data_InputField = transform.Find("inroomPanel/imPanel/SendCustom_Data_InputField").GetComponent<InputField>();transform.Find("inroomPanel/imPanel/SendCustom_Btn").GetComponent<Button>().onClick.AddListener(delegate (){string data = SendCustom_Data_InputField.text;string str_count = SendCustom_Count_InputField.text;int count = 0;if (int.TryParse(str_count, out count)) {Debug.Log(data+ count.ToString());byte[] byteData = Encoding.Default.GetBytes(data);int ret = ITMGContext.GetInstance().GetRoom().SendCustomData(byteData, count);if(ret != 0 ) {ShowWarnning(string.Format("send customdata failed err:{0}",ret));}}});}
-(IBAction)SendCustData:(UIButton*)sender {int ret = ret = [[[ITMGContext GetInstance] GetRoom] SendCustomData:[NSData dataWithBytes:dataInput_textfiled_.text.UTF8String length:dataInput_textfiled_.text.length] repeatCout:-1];if(ret != 0){UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"set fail" message:[NSString stringWithFormat:@"SendCustomData:errorcode :%d",ret] delegate:NULL cancelButtonTitle:@"OK" otherButtonTitles:nil];[alert show];}}
if (ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_CUSTOMDATA_UPDATE == type) {int subtype = data.getIntExtra("sub_event",-1);if (subtype == 0) {String content = data.getStringExtra("content");String sender = data.getStringExtra("senderid");Toast.makeText(getActivity(), String.format("recv content =%s, from:%s", content,sender), Toast.LENGTH_SHORT).show();}
void OnEvent(int eventType,int subEventType,string data){Debug.Log (data);switch (eventType) {case (int)ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_CUSTOMDATA_UPDATE:{if(subEventType == (int)ITMG_CUSTOMDATA_SUB_EVENT.ITMG_CUSTOMDATA_AV_SUB_EVENT_UPDATE) {_customData = JsonUtility.FromJson<CustomDataInfo>(data);ShowWarnning(string.Format("recve customdata {0} from {1}",_customData.content,_customData.senderid));}}break;}
-(int) StopSendCustomData;
public abstract int StopSendCustomData();
public abstract int StopSendCustomData();
StopSendCustomData returns error code 1003, this API has been called and its operation is being performed by the SDK, so there is no need to call it again.Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan