Updated on 2023-03-23 GMT+08:00

Scenario 6: Creating a Meeting

Description

Create an instant meeting and immediately join the meeting. You can specify whether the meeting is a voice or video meeting and whether a password is required by setting input parameters.

Service Process

  1. Define parameters required for creating a meeting.

    Prepare parameters for creating a meeting. The type is CreateConfParam. For details, see the definition of CreateConfParam. The following parameters are required: meeting subject, meeting type, whether a password is required, participant list (passed when participants are carried), whether to enable the camera (disabled by default), whether to enable the microphone (disabled by default), cloud meeting room ID (passed when a cloud meeting room is used), and the scope of users who are allowed to join the meeting (mandatory. 0: everyone; 2: corporate users only; 3: invited users only)
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    // Create a CreateConfParam object.
    CreateConfParam createConfParam = new CreateConfParam()                             
          .setSubject("Huawei's meeting") // Set the meeting name.
          .setConfType(ConfType.CONF_AUDIO)        // Set the meeting type. For details, see CreateConfParam parameters.
          .setVmrId(2c9183e07562e60b0175647ea92f59b3)         // (Optional) Set the cloud meeting room ID.
          .setJoinConfRestrictionType(JoinConfPermissionType.PERMIT_EVERYONE)   // Specify the scope of users who are allowed to join the meeting.
          .setCameraOn(true)           // Specify whether to enable the camera.
          .setMicOn(true)              // Specify whether to enable the microphone.
          .setRecordOn(true)    // Specify whether to enable meeting recording.
          .setNeedPassword(true);    // Specify whether a password is required.
    

  2. (Optional) Specify whether to carry participant information.

    If participant information needs to be carried when creating a meeting, set members in the parameters generated in the previous step to an array that carries participant information. If participant information does not need to be carried, the parameter members does not need to be carried.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    List<AttendeeModel> attendeeList = new ArrayList<>();
            // The following three methods are available:
                String name = "huawei123456";
    	    String number = "+99123456xxx";
    	    String thirdAccount = "123456abcd";
                if (!TextUtils.isEmpty(thirdAccount)) {
                    if (LoginStatusCache.getsLoginAccountInfo() instanceof AppIdAuthParam) {
                        // An app ID is used for login.
                        attendeeList.add(AttendeeModel.buildAttendeeByThirdAccountId(thirdAccount,name));
                    }
                } else if(number.startsWith("+99")){
                    // A SIP number is used to join the meeting.
                    attendeeList.add(AttendeeModel.buildAttendeeBySipNumber(number, name));
                } else {
                    // A mobile number or a fixed-line phone number is used to join the meeting.
                    attendeeList.add(AttendeeModel.buildAttendeeByPhone(number, name));
                }
    // Create a CreateConfParam object.
    CreateConfParam createConfParam = new CreateConfParam()                             
          .setSubject("Huawei's meeting") // Set the meeting name.
          .setConfType(ConfType.CONF_AUDIO)        // Set the meeting type. For details, see .
          .setVmrId(2c9183e07562e60b0175647ea92f59b3)         // (Optional) Set the cloud meeting room ID.
          .setJoinConfRestrictionType(JoinConfPermissionType.PERMIT_EVERYONE)   // Specify the scope of users who are allowed to join the meeting.
          .setCameraOn(true)           // Specify whether to enable the camera.
          .setMicOn(true)              // Specify whether to enable the microphone.
          .setRecordOn(true)    // Specify whether to enable meeting recording.
          .setNeedPassword(true)    // Specify whether a password is required.
          .setAttendeeMembers(attendeeInfos);    // Add participant information.
    

  3. Call the API.

    Use the meeting creation parameters generated in 1 and 2, and check and process the execution result based on the callback. In the callback, onSuccess indicates a success, onFailed indicates a failure, and onCancel indicates that the creation is canceled due to no network. You can use ErrorMessageFactory.create to convert the scenario-specific error code into an error message.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Create a meeting.
HWMSdk.getOpenApi(getActivity()).createConf(createConfParam, new HwmCancelableCallBack <ConfInfo>() {              
     @Override              
     public void onSuccess(ConfInfo confInfo) {                    
            // The meeting details are displayed when the meeting is created.
           // Meeting ID: confInfo.getConfId();
           // Meeting password: confInfo.getConfPwd();
     }               
     @Override              
     public void onFailed(int retCode, String desc) {           
           // Failed to create the meeting.
           String err = ErrorMessageFactory.create(Utils.getApp(), retCode);
           if (TextUtils.isEmpty(err)) {                       
                 err = Utils.getApp().getString(com.huawei.hwmmobileconfui.R.string.conf_create_error);                   
           }                  
           Log.i(TAG, "Failed to create the meeting: "+ err);
     }         
     @Override
     public void onCancel() {
          Log.i(TAG, "Meeting creation canceled");.
     }
});

Precautions

The initialization and login are complete before you create a meeting.