Skip to content

Group Call

adamrangs edited this page Aug 8, 2022 · 1 revision
  1. Use the webex.spaces().create() API to create a Space.

    webex.spaces().create("hello world",null,(result) -> {
            if (result.isSuccessful()) {
                Space space  = result.getData();
                //....
            } else {
                //....
            }
        });
  2. Use the webex.memberships().create() API to add people to the Space.

    webex.memberships().create(spaceId,null,personEmail,true, (result) -> {
            if (result.isSuccessful()) {
              //....
            } else {
              //....
            }
        });
  3. Dial a space by space id to make a group call with all peoples in the space.

    webex.phone().dial(spaceId, MediaOption. audioVideoSharing(new Pair<>(localView,remoteView),shareView), (result) -> {
            if (result.isSuccessful()) {
                call = result.getData();
                call.setObserver(callObserver);
            }
            //...
        });
  4. In order to get the event of a participant in the call, the callback function onCallMembershipChanged is used.

    @Override
    public void onCallMembershipChanged(CallMembershipChangedEvent callMembershipChangeEvent) {
        CallMembership membership = callMembershipChangeEvent.getCallMembership();
        if (callMembershipChangeEvent instanceof MembershipJoinedEvent) {
            Ln.d("The " + membership.getEmail() + " accept the call and joins to the Space");
        } else if (callMembershipChangeEvent instanceof MembershipLeftEvent) {
            Ln.d("The " + membership.getEmail() + " hangup the call and leaves to the Space");
        } else if (callMembershipChangeEvent instanceof MembershipDeclinedEvent) {
            Ln.d("The " + membership.getEmail() + " decline the call");
        } else if (callMembershipChangeEvent instanceof MembershipSendingVideoEvent) {
            Ln.d("The " + membership.getEmail() + (membership.isSendingVideo() ? " unmute ":" mute " ) + " video");
        } else if (callMembershipChangeEvent instanceof MembershipSendingAudioEvent) {
            Ln.d("The " + membership.getEmail() + (membership.isSendingAudio() ? " unmute ":" mute " ) + " voice");
        } else if (callMembershipChangeEvent instanceof MembershipSendingSharingEvent) {
            Ln.d("The " + membership.getEmail() + (membership.isSendingSharing() ? " start ":" stop " ) + " sharing");
        }
    }
Clone this wiki locally