CjConnectivity
|
Instance Methods | |
(id) | - initWithToken:myDeviceId: |
Initializes library and sets local device unique ID. More... | |
(void) | - deinit |
Disconnects from other device if needed and deinitializes library. | |
(CoError) | - sendMsg:toOtherDeviceId: |
Send message to other device via signaling. More... | |
(CoError) | - connectToOtherDeviceId: |
Establish a data connection to another device. More... | |
(BOOL) | - isConnected |
Check if we have a data connection with the other device. More... | |
(BOOL) | - isConnectedViaConnectionType: |
Check if we have a data connection with the other device via a specific data connection type. More... | |
(CoError) | - sendVideoH264Frame: |
Send H.264 video frame (NALU). More... | |
(CoError) | - sendVideoH264DataChunk: |
Send H.264 video data chunk. More... | |
(CoError) | - sendAudioFrames: |
Send audio frames. More... | |
(CoError) | - sendOtherData: |
Send data that is neither H.264 video nor audio. More... | |
(void) | - disconnect |
Disconnects from other device. | |
(void) | - registerPushNotificationsFromDevice:myDeviceToken: |
Registers this device's token to receive push notifications from other device. More... | |
(CoError) | - sendPushNotificationMsg:action: |
Send push notification to other device. More... | |
Properties | |
id< CjConnectivityDelegate > | delegate |
|
protected |
CoConnectionEvent gives information about events occurring with a specific connection.
Enumerator | |
---|---|
CoConnectionEventIncreaseVideoBitrate | Network conditions are good enough for a higher bitrate than the one currently used. Increase the video resolution/bitrate when receiving this event. |
CoConnectionEventReduceVideoBitrate | Network conditions are not good enough for current bitrate. Reduce the video resolution/bitrate when receiving this event. |
CoConnectionEventMessagingReady | Device is ready to receive messages to its unique ID. |
CoConnectionEventDisconnectNetworkChange | Got disconnected because of a network change (such as network lost for example). |
CoConnectionEventDisconnectPeerStoppedResponding | Peer stopped responding, indicating that peer either crashed or lost its network connection. |
CoConnectionEventDisconnectSignalReceivedFromPeer | Peer sent disconnection request. |
CoConnectionEventConnecting | Received a connection request and started initiating connection. |
CoConnectionEventConnectSuccessOtherConnectionType | Connection was successful on one of the other two of three connection types (CoConnectionType). Gets received on second and third successful connection type. |
CoConnectionEventConnectSuccess | Connection was successful. Gets received when first of 3 possible connection types gets established. |
CoConnectionEventConnectFailTokenError | Something is wrong with the token provided. |
CoConnectionEventConnectFailTokenExpired | The token provided is expired. |
CoConnectionEventConnectFailTimeout | It took too long to attempt the connection. Perhaps the other device is not connected to the network. |
CoConnectionEventConnectFailMaxConnectionsExceeded | Already attempted the maximum number of connections allowed. |
CoConnectionEventConnectFailVersionTooOld | This device's version is too old and not compatible with other device. |
CoConnectionEventConnectFailOtherDeviceVersionTooOld | Other device's version is too old and not compatible with this device. |
CoConnectionEventConnectFailSessionMaxTimeReached | The token used has a session maximum time limit and that limit has been reached. Contact suppo to get a token with no limit. rt@s eajei .com |
|
protected |
The CoConnectionType indicates what kind of connection we are dealing with (direct local connection, peer-to-peer via public internet, or via server relay).
|
protected |
Most methods will return an CoError code. The code indicates success or what type of failure happened.
Enumerator | |
---|---|
CoSuccess | Success return value. No error occurred. |
CoFailure | A generic error. Not enough information for a specific error code. |
CoBadParameter | An input parameter is bad. |
CoInternalError | An internal error has occurred. |
CoUninitialized | Trying to call functions that need initialization first. |
CoAlreadyInitialized | Trying to initialize but we are already initialized. |
CoTokenError | There was an error with the token. |
CoTokenExpired | Token status is expired. |
CoOffline | The network connection is offline. |
CoDisconnected | The data connection is disconnected. |
CoMaxConnectionsExceeded | Already attempted the maximum number of connections allowed. |
CoTokenMinReconnectInterval | Attempted to reconnect more quickly than minimum interval tied to this token. Contact suppo to get your own token to remove this limitation. rt@s eajei .com |
- (CoError) connectToOtherDeviceId: | (NSString *) | otherDeviceId |
Establish a data connection to another device.
Data connection will be used to stream video, audio or other type of data.
otherDeviceId | The unique ID of the destination device. |
- (id) initWithToken: | (NSString *) | token | |
myDeviceId: | (NSString *) | myDeviceId | |
Initializes library and sets local device unique ID.
token | A unique token (please contact suppo to obtain yours). rt@s eajei .com |
myDeviceId | Unique device ID for this device. Maximum length is 32. |
- (BOOL) isConnected |
Check if we have a data connection with the other device.
- (BOOL) isConnectedViaConnectionType: | (CoConnectionType) | connectionType |
Check if we have a data connection with the other device via a specific data connection type.
connectionType | The type of connection we want to check. |
- (void) registerPushNotificationsFromDevice: | (NSString *) | otherDeviceId | |
myDeviceToken: | (NSString *) | myDeviceToken | |
Registers this device's token to receive push notifications from other device.
otherDeviceId | The unique ID of the destination device. |
myDeviceToken | Device token for this device. |
- (CoError) sendAudioFrames: | (NSData *) | audioFrames |
Send audio frames.
After a number of audio frames are captured from the microphone (and typically encoded with an audio codec), use this function to send it.
audioFrames | The audio frames. Maximum size is 916. If size is bigger, separate the audioFrames into smaller pieces and send those. |
- (CoError) sendMsg: | (NSString *) | msg | |
toOtherDeviceId: | (NSString *) | otherDeviceId | |
Send message to other device via signaling.
There is no need to establish a connection first. Message is guaranteed to be received if both devices are connected to the internet and both devices have been initialized and received the CoConnectionEventMessagingReady connection event. Use for small messages only (up to 5 KB), not for streaming audio or video.
msg | The message to send. |
otherDeviceId | The unique ID of the destination device. |
- (CoError) sendOtherData: | (NSData *) | data |
Send data that is neither H.264 video nor audio.
data | The data to be sent. |
- (CoError) sendPushNotificationMsg: | (NSString *) | msg | |
action: | (NSString *) | action | |
Send push notification to other device.
Sending push notifications will only work if other device previously registered push notifications.
msg | Text that gets displayed in push notification. |
action | The action string gets embedded into the push notification and can be retrieved on the app side when user taps notification. |
- (CoError) sendVideoH264DataChunk: | (NSData *) | h264DataChunk |
Send H.264 video data chunk.
In case random lengths of partial frame data (ordered) are captured (rather than full frames), use this function as it will figure out the beginnings and ends of frames and send them out.
h264DataChunk | The partial frame data. |
- (CoError) sendVideoH264Frame: | (NSData *) | h264Frame |
Send H.264 video frame (NALU).
Send iFrame, pFrame, SPS, or PPS. SPS/PPS, or SPS/PPS/iFrame may be combined into a single frame.
h264Frame | The frame. |