createCallSession method

  1. @override
P2PSession createCallSession(
  1. int callType,
  2. Set<int> opponentsIds, {
  3. bool startScreenSharing = false,
  4. DesktopCapturerSource? desktopCapturerSource,
  5. bool useIOSBroadcasting = false,
})
override

Creates the instance of ConferenceSession. callType - can be CallType.VIDEO_CALL or CallType.AUDIO_CALL. opponentsIds - the set of ids of users you want to call. startScreenSharing - set true if want to initialize the call with Screen sharing feature. desktopCapturerSource - the desktop capturer source, if it is null the default Window/Screen will be captured. Use only for desktop platforms. Use ScreenSelectDialog to give the user a choice of the shared Window/Screen. useIOSBroadcasting - set true if the Broadcast Upload Extension was added to your iOS project for implementation Screen Sharing feature, otherwise set false and in-app Screen Sharing will be started. Used for iOS platform only. See our step-by-step guide on how to integrate the Screen Broadcasting feature into your iOS app.

Implementation

@override
P2PSession createCallSession(
  int callType,
  Set<int> opponentsIds, {
  bool startScreenSharing = false,
  DesktopCapturerSource? desktopCapturerSource,
  bool useIOSBroadcasting = false,
}) {
  int callerId = CubeChatConnection.instance.currentUser?.id ?? -1;

  CubeRTCSessionDescription cubeSdp = CubeRTCSessionDescription(
    callerId,
    opponentsIds,
    callType,
  );
  P2PSession session = P2PSession(this, cubeSdp,
      startScreenSharing: startScreenSharing,
      desktopCapturerSource: desktopCapturerSource,
      useIOSBroadcasting: useIOSBroadcasting);

  _sessions[session.sessionId] = session;

  return session;
}