JCClient ======== .. contents:: :depth: 3 :backlinks: top Overview -------- `JCClient `_ is the main interface to manage a JumpChat session. Events can be handled through the `JCClientDelegate `_ protocol. Inherits -------- .. code-block:: objc @interface JCClient : NSObject Properties ---------- room ++++ The name of the room that is joined. ``nil`` otherwise. .. code-block:: objc @property (nonatomic, readonly) NSString *room; password ++++++++ Password of the room if locked. Empty string otherwise. .. code-block:: objc @property (nonatomic, copy) NSString *password; username ++++++++ Username of the user. By default, it is the device name if not set. .. code-block:: objc @property (nonatomic, copy) NSString *username; avatar ++++++ Avatar of the user. By default, it is the ``default-avatar.jpg`` file in the JumpChatSDK.bundle directory. .. code-block:: objc @property (nonatomic, copy) UIImage *avatar; captureFrontCamera ++++++++++++++++++ State of which camera to capture. Front or back. .. code-block:: objc @property (nonatomic, readonly) BOOL captureFrontCamera; messages ++++++++ Array of text messages. Each message is a ``NSDictionary`` that has the following keys. :userid: User id of the person. ``me`` if it's your own message. :message: String of the message. :timestamp: ``NSDate`` object .. code-block:: objc @property (nonatomic, readonly) NSMutableArray *messages; videos ++++++ Array of text messages. The key is the userid and the value is `JCGLVideoView `_. .. code-block:: objc @property (nonatomic, readonly) NSMutableDictionary *videos; videoEnabled ++++++++++++ Boolean whether the video is enabled or not. By default it is ``YES``. You can disable the video by setting this variable to ``NO``. .. code-block:: objc @property (nonatomic) BOOL videoEnabled; audioEnabled ++++++++++++ Boolean whether the video is enabled or not. By default it is ``YES``. You can disable the audio by setting this variable to ``NO``. .. code-block:: objc @property (nonatomic) BOOL audioEnabled; turnIceServers ++++++++++++++ Override the default ICE servers. You should not have to change this. .. code-block:: objc @property (nonatomic, strong) NSArray *turnIceServers; admin +++++ Boolean that determines if the current user is an admin of ther room. .. code-block:: objc @property (nonatomic, readonly) BOOL admin; locked ++++++ Boolean that determines if the current room is locked. .. code-block:: objc @property (nonatomic, readonly) BOOL locked; Methods ------- initWithDelegate:options: +++++++++++++++++++++++++ Initialization method. .. code-block:: objc - (id)initWithDelegate:(id)delegate options:(NSDictionary *)options; :delegate: `JCClientDelegate `_ implementation :options: ``NSDictionary`` containing options * ``apiKey`` - Set the API key * ``userid`` - Set userid. NSString representing the userid. * ``username`` - Set username. NSString representing the userid. * ``avatar`` - Set avatar. URL for the avatar. Can be base64 data url. * ``audioBandwidth`` - Set the audio bandwidth in kbps * ``videoBandwidth`` - Set the audio bandwidth in kbps join:type: ++++++++++ Join a room. .. code-block:: objc - (void)join:(NSString *)room type:(NSString *)type; :room: Name of the room. :type: ``random`` or ``custom`` * Random rooms must have a length of 10. * Custom rooms must exist otherwise a disconnect message will be sent. leave +++++ Leave the room. .. code-block:: objc - (void)leave; startBroadcasting +++++++++++++++++ Start broadcasting audio and video. The delegate ``jc:videoAdded:view:`` will be called with ``me`` as the userid. .. code-block:: objc - (void)startBroadcasting; stopBroadcasting ++++++++++++++++ Stop broadcasting the audio and video. You don't normally call this method. .. code-block:: objc - (void)stopBroadcasting; changeCamera: +++++++++++++ Change the camera from front to back. .. code-block:: objc - (void)changeCamera:(BOOL)front; :front: ``YES`` for front camera and ``NO`` for back camera. sendTextMessage: ++++++++++++++++ Send a text message to everyone in the room. .. code-block:: objc - (void)sendTextMessage:(NSString *)text; :text: Text message to broadcast avatarForUserId: ++++++++++++++++ Get the avatar for a given userid. .. code-block:: objc - (UIImage *)avatarForUserId:(NSString *)userid; :userid: User id string usernameForUserId: ++++++++++++++++++ Get the username for a given userid. .. code-block:: objc - (NSString *)usernameForUserId:(NSString *)userid; :userid: User id string lockRoom: +++++++++ Lock the room. This will only work if you are an admin. .. code-block:: objc - (void)lockRoom:(BOOL)lock; :lock: ``YES`` to lock or ``NO`` to unlock. kick: +++++ Kick a user from the room.. This will only work if you are an admin. .. code-block:: objc - (void)kick:(NSString *)userid; :userid: User id string knock: ++++++ Try to enter a room by knocking and give a message. .. code-block:: objc - (void)knock:(NSString *)msg; :msg: Message to the admin of the user startCapturerer +++++++++++++++ Start the camera capturer. You do this when you are done with the camera. This will tell ``JCClient`` to gain access to the camera. .. code-block:: objc - (void)startCapturer; stopCapturer ++++++++++++ Stop the camera capturer. You do this when you need access to the camera. This will tell ``JCClient`` to release access to the camera. .. code-block:: objc - (void)stopCapturer; muteVideo:state: ++++++++++++++++ Mute a remote video stream. .. code-block:: objc - (void)muteVideo:(NSString *)userid state:(BOOL)state; :userid: User id string :state: ``YES`` to unmute or ``NO`` to mute muteAudio:state: ++++++++++++++++ Mute a remote audio stream. .. code-block:: objc - (void)muteAudio:(NSString *)userid state:(BOOL)state; :userid: User id string :state: ``YES`` to unmute or ``NO`` to mute