java.lang.Object | |
↳ | sg.com.temasys.skylink.sdk.rtc.SkylinkConnection |
Main class to connect to the Skylink infrastructure.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
enum | SkylinkConnection.SkylinkState | Possible states of the SkylinkConnection instance. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | DEFAULT_DURATION | Duration in hours after the start time when the room will be closed by the signalling server. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
acceptFileTransfer(String filePath, String remotePeerId, SkylinkCallback errorCallback)
Call this method to accept the file share request from a remote peer.
| ||||||||||
void |
cancelFileTransfer(String remotePeerId, boolean forSending, SkylinkCallback errorCallback)
Call this method to cancel the file share request from/to a remote peer.
| ||||||||||
void |
changeLocalMediaState(String mediaId, SkylinkMedia.MediaState newMediaState, SkylinkCallback errorCallback)
Change the state of the local media and notifies all the peers in the room,
including mute/unmute, stop/start the media.
| ||||||||||
void |
clearInstance()
Clears all properties of SkylinkConnection instance, including services, config and media objects
SkylinkConnection instance remains (not set to null), as per Singleton pattern.
| ||||||||||
void |
connectToRoom(String appKey, String secret, String roomName, Object userData, SkylinkCallback errorCallback)
Connects to a room with the default duration of 24 hours and with the current time.
| ||||||||||
void |
connectToRoom(String skylinkConnectionString, Object userData, SkylinkCallback errorCallback)
Connects to a room using a SkylinkConnectionString that caller MUST ensure is URL safe.
| ||||||||||
void |
createLocalMedia(SkylinkConfig.MediaDevice mediaDevice, Object mediaMetadata, SkylinkCallback errorCallback)
Create local media using the provided
SkylinkConfig.MediaDevice
Valid condition for the process are:
- SkylinkConfig allows to send it. | ||||||||||
void |
createLocalMedia(SkylinkConfig.MediaDevice mediaDevice, Object mediaMetadata, int width, int height, int fps, SkylinkCallback errorCallback)
Create local media using the provided
SkylinkConfig.MediaDevice
Valid condition for the process are:
- SkylinkConfig allows to send it. | ||||||||||
void |
createLocalMedia(SkylinkConfig.MediaDevice mediaDevice, Object mediaMetadata, VideoCapturer customVideoCapturer, int width, int height, int fps, SkylinkCallback errorCallback)
Create local media using the provided
SkylinkConfig.MediaDevice
Valid condition for the process are:
- SkylinkConfig allows to send it. | ||||||||||
void |
destroyLocalMedia(String mediaId, SkylinkCallback errorCallback)
Destroy a specific local media object by media id
Result will be informed in
onDestroyLocalMedia(SkylinkMedia) if local media
is removed successfully OR onReceiveWarning(SkylinkError, HashMap) if local media
can not be removed or any error occurs
The destroyed media object is not actually removed from SDK, but the media track is disposed and
media state is changed to | ||||||||||
void |
disconnectFromRoom(SkylinkCallback errorCallback)
Disconnects from the room we are currently in, all local media and SkylinkConnection instance are still kept locally
Once disconnect is complete,
onDisconnectFromRoom(SkylinkEvent, String)
will be triggered. | ||||||||||
String[] | getAllCameraNames() | ||||||||||
SkylinkCaptureFormat[] |
getAllCaptureFormats(SkylinkConfig.VideoDevice videoDevice)
Get the possible capture format(s) of the specified camera device in an array.
| ||||||||||
CameraEnumerator |
getCameraEnumerator()
Get the CameraEnumerator to use.
| ||||||||||
String |
getCameraName(SkylinkConfig.VideoDevice videoDevice)
Get the actual Android camera name for the given
SkylinkConfig.VideoDevice . | ||||||||||
String |
getCurrentCameraName()
Get the name of the current camera being used.
| ||||||||||
SkylinkCaptureFormat |
getCurrentCaptureFormat()
Return the
SkylinkCaptureFormat that is currently being used by the camera. | ||||||||||
SkylinkConfig.VideoDevice |
getCurrentVideoDevice()
Get the current
VideoDevice being used. | ||||||||||
DataTransferListener | getDataTransferListener() | ||||||||||
Map<String, String> |
getEncryptSecretsMap()
Get the encryption secret map set in the SDK, if any.
| ||||||||||
FileTransferListener | getFileTransferListener() | ||||||||||
void |
getInputVideoResolution(String mediaId, SkylinkCallback.InputVideoResolution callback)
Get the current resolution of the input video being captured by the local camera or local screen
and the SkylinkCaptureFormat used.
| ||||||||||
synchronized static SkylinkConnection | getInstance() | ||||||||||
LifeCycleListener | getLifeCycleListener() | ||||||||||
String |
getLocalPeerId()
Get our PeerId, or return null if not available.
| ||||||||||
MediaListener | getMediaListener() | ||||||||||
MessagesListener | getMessagesListener() | ||||||||||
OsListener | getOsListener() | ||||||||||
String[] |
getPeerIdList()
Return a String array of PeerIds of connected Peers, including selfPeer.
| ||||||||||
void |
getReceivedTransferSpeed(String mediaId, SkylinkCallback.TransferSpeed callback)
Request for the instantaneous receiving transfer speed(s) of a remote media track, at the moment of request.
| ||||||||||
void |
getReceivedVideoResolution(String mediaId, SkylinkCallback.ReceivedVideoResolution callback)
Get the current resolution of the video received from a specific Peer.
| ||||||||||
void |
getReceivedWebRtcStats(String mediaId, SkylinkCallback.WebRtcStats callback)
Request for WebRTC statistics of the specified remote media track which we are receiving from remote peer
Result will be delivered via callback
onReceiveWebRtcStats(HashMap) | ||||||||||
RecordingListener | getRecordingListener() | ||||||||||
RemotePeerListener | getRemotePeerListener() | ||||||||||
String |
getRoomId()
Provides the room ID of the room currently connected to.
| ||||||||||
String |
getSelectedSecretId()
Get the secretId of the secret to use when SDK needs to perform encryption.
| ||||||||||
void |
getSentTransferSpeed(String mediaId, String remotePeerId, SkylinkCallback.TransferSpeed callback)
Request for the instantaneous sending transfer speed(s) of a local media track to a specific remote peer, at the moment of request.
| ||||||||||
void |
getSentVideoResolution(String remotePeerId, String mediaId, SkylinkCallback.SentVideoResolution callback)
Get the current resolution of the video being sent to a specific Peer.
| ||||||||||
void |
getSentWebRtcStats(String mediaId, String remotePeerId, SkylinkCallback.WebRtcStats callback)
Request for WebRTC statistics of the specified local media track which streams to a specific remote peer
Result will be delivered via callback
onReceiveWebRtcStats(HashMap) | ||||||||||
SkylinkMedia |
getSkylinkMedia(String mediaId)
Get a specific SkylinkMedia based on mediaId, applied for both local and remote media
| ||||||||||
List<SkylinkMedia> |
getSkylinkMediaList(SkylinkMedia.MediaType mediaType, String peerId)
Get a list of SkylinkMedia objects based on media type and peer id
| ||||||||||
SkylinkConnection.SkylinkState |
getSkylinkState()
Gets the current
SkylinkState of the current SkylinkConnection instance. | ||||||||||
static String |
getSkylinkVersion()
Gets the version of this Skylink SDK for Android as a String, for e.g.
| ||||||||||
void |
getStoredMessages(SkylinkCallback.StoredMessages callback)
Get the current list of message(s) stored on server.
| ||||||||||
UserInfo |
getUserInfo(String peerId)
Retrieves the UserInfo object of a Peer, including user data.
| ||||||||||
void |
init(SkylinkConfig config, Context applicationContext, SkylinkCallback errorCallback)
Initialize a SkylinkConnection instance with the specified parameters.
| ||||||||||
boolean |
isEnableLogs()
Checks if logging is enabled for SDK.
| ||||||||||
boolean |
isMessagePersist()
Checks whether the next public server message sent should be persisted,
as described at
setMessagePersist(boolean) . | ||||||||||
boolean |
isMultiTrackCreateEnable()
Check the SDK currently supports for multitracks or not.
| ||||||||||
boolean |
isRecording()
Checks if we are currently performing recording.
| ||||||||||
boolean |
isRoomLocked()
Checks if the room is locked.
| ||||||||||
void |
lockRoom(SkylinkCallback errorCallback)
Locks the room if it is not locked
| ||||||||||
boolean |
processActivityResult(int requestCode, int resultCode, Intent data)
Process Android Intent based permission result received by App via Android callback
android.app.Activity#onActivityResult(int, int, Intent).
| ||||||||||
boolean |
processPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
Process Android Runtime permission result received by App via Android callback
android.app.Activity#onRequestPermissionsResult.
| ||||||||||
void |
refreshConnection(String remotePeerId, boolean doIceRestart, SkylinkCallback errorCallback)
Refreshes a connection with a specific peer or all connections with peers in room.
| ||||||||||
void |
rejectFileTransfer(String remotePeerId, SkylinkCallback errorCallback)
Call this method to reject the file share request from a remote peer.
| ||||||||||
void |
sendData(byte[] data, String remotePeerId, SkylinkCallback errorCallback)
Sends a byte array to a specified remotePeer or to all remote peers in the room.
| ||||||||||
void |
sendFileTransfer(String filePath, String fileName, String remotePeerId, SkylinkCallback errorCallback)
Sends request(s) to share file with a specific remote peer or to all remote peers in the same room.
| ||||||||||
void |
sendLocalUserData(Object localUserData, SkylinkCallback errorCallback)
Sends local user data related to oneself, to all remote peers in our room.
| ||||||||||
void |
sendP2PMessage(Object message, String remotePeerId, SkylinkCallback errorCallback)
Sends a user defined message to a specific remote peer or to all remote peers in a direct
peer to peer manner.
| ||||||||||
void |
sendServerMessage(Object message, String remotePeerId, SkylinkCallback errorCallback)
Sends a user defined message to a specific remote peer or to all remote peers via a server.
| ||||||||||
void |
setDataTransferListener(DataTransferListener dataTransferListener)
Sets the specified data transfer listener object.
| ||||||||||
void |
setEnableLogs(boolean enableLogs)
Sets if logging should be enabled for SDK.
| ||||||||||
void |
setEncryptSecretsMap(Map encryptSecretsMap)
Set a key value map of secretId and encryption secret for generating key for SDK encryption.
| ||||||||||
void |
setFileTransferListener(FileTransferListener fileTransferListener)
Sets the specified file transfer listener object.
| ||||||||||
void |
setInputVideoResolution(String mediaId, int width, int height, int fps, SkylinkCallback errorCallback)
Change the current captured video track of a specific SkylinkMedia to the specified resolution,
and the specified resolution will be set into SkylinkConfig.
| ||||||||||
void |
setLifeCycleListener(LifeCycleListener lifeCycleListener)
Sets the specified life cycle listener object.
| ||||||||||
void |
setMediaListener(MediaListener mediaListener)
Sets the specified media listener object that will receive callbacks related to Media
Stream.
| ||||||||||
void |
setMessagePersist(boolean toPersist)
Sets whether the next public server message sent should be persisted on Temasys server.
| ||||||||||
void |
setMessagesListener(MessagesListener messagesListener)
Sets the specified messages listener object.
| ||||||||||
void |
setOsListener(OsListener osListener)
Sets the specified OS listener object.
| ||||||||||
void | setRecordingListener(RecordingListener recordingListener) | ||||||||||
void |
setRemotePeerListener(RemotePeerListener remotePeerListener)
Sets the specified remote peer listener object.
| ||||||||||
void |
setSelectedSecretId(String secretId)
Set the secretId of the secret to use when SDK needs to perform encryption.
| ||||||||||
void |
startRecording(SkylinkCallback errorCallback)
Start recording if conditions allows:
- We must be using Skylink Media Relay.
| ||||||||||
void |
stopRecording(SkylinkCallback errorCallback)
Stop recording if conditions allows:
- We must be already be recording.
| ||||||||||
void |
switchCamera(SkylinkCallback errorCallback)
Call this method to switch between available cameras.
| ||||||||||
void |
unlockRoom(SkylinkCallback errorCallback)
Unlocks the room if it is already locked
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Duration in hours after the start time when the room will be closed by the signalling server.
Call this method to accept the file share request from a remote peer. This can be only process if config has file transfer
filePath | The absolute path of the file where we want it to be saved locally. |
---|---|
remotePeerId | The id of the remote peer that requested to share with us a file. |
errorCallback | The error callback if the process failed. Can be null if error processing is not required. |
Call this method to cancel the file share request from/to a remote peer. Note: This function is not yet supported in Skylink v2.0.0
remotePeerId | The id of the remote peer that requested to share with us a file. |
---|---|
forSending | The flag to distinguish for cancelling a file from sender or from receiver |
errorCallback | The error callback if the process failed. |
Change the state of the local media and notifies all the peers in the room, including mute/unmute, stop/start the media.
For MUTED: mute the local media, however, black frames will still be transferred to the remote peers. For e.g. remote peer will receive black frame video from self peer
For STOPPED: stops the local media resource like media capturer, so no media content will be captured or transferred to the remote peers. When media is toggled to stopped, media device is accessible by other apps, for e.g. camera can be used to take pictures by other apps. Toggling media off and on is a little bit slower than muting and unmuting
Method will trigger errorCallback.onError if an error occurs, for e.g. with:
MEDIA_STATE_CHANGE_FAILED
if local media is not available.
mediaId | The getMediaId() of the SkylinkMedia
to operate on.
If null, operation will apply on all local media. |
---|---|
newMediaState | The new state for the local media, only accept these values:
ACTIVE for unmute media or restart media,
MUTED for mute media,
STOPPED for stop media |
errorCallback | The error callback for the user to know the result of processing Can be null if error processing is not required. |
Clears all properties of SkylinkConnection instance, including services, config and media objects
SkylinkConnection instance remains (not set to null), as per Singleton pattern.
It should not be done if SkylinkConnection
is expected to continue to operate in the current configuration.
This should be called when SkylinkConnection
is not expected to be used any more
in the current application, or if
the user wants to apply a different SkylinkConfig for the SkylinkSDK.
To reuse the SkylinkConnection instance after this process, please use
init(SkylinkConfig, Context, SkylinkCallback)
to create a new session.
Connects to a room with the default duration of 24 hours and with the current time.
Local media will not be started by this method.
To create local media, call createLocalMedia(SkylinkConfig.MediaDevice, Object, SkylinkCallback)
.
It is encouraged to use the method connectToRoom(String, Object, SkylinkCallback)
If process is failed, the detail error will be return in errorCallback if it was provided
and result callback onConnectToRoomFailed(String)
will be triggered
If process is successful, the result callback LifeCycleListener#onConnectToRoomSuccessful() will be triggered
appKey | The Nonnull App key from the Skylink Developer Console |
---|---|
secret | The Nonnull secret associated with the app key |
roomName | The Nonnull name of the room connecting to |
userData | User defined data relating to oneself like userName. May be a 'java.lang.String', 'org.json.JSONObject' or 'org.json.JSONArray' or null |
errorCallback | The error callback if the process failed. Can be null if error processing is not required. |
Connects to a room using a SkylinkConnectionString that caller MUST ensure is URL safe.
Local media will not be started by this method.
To create local media, call createLocalMedia(SkylinkConfig.MediaDevice, Object, SkylinkCallback)
.
If process is failed, the detail error will be return in errorCallback if it was provided
and result callback onConnectToRoomFailed(String)
will be triggered
If process is successful, the result callback LifeCycleListener#onConnectToRoomSuccessful() will be triggered.
skylinkConnectionString | A Nonnull ConnectionString generated with room name, appKey, secret, startTime and duration. This string MUST be URL safe. |
---|---|
userData | User defined data relating to oneself like userName. May be a 'java.lang.String', 'org.json.JSONObject' or 'org.json.JSONArray' or null |
errorCallback | The error callback if the process failed. Can be null if error processing is not required. |
Create local media using the provided SkylinkConfig.MediaDevice
Valid condition for the process are:
- SkylinkConfig allows to send it.
- Media of the same SkylinkMedia.MediaType
as SkylinkConfig.MediaDevice
is not currently started.
Media will be started by default the SDK that matches the SkylinkConfig.MediaDevice
provided.
If successful, local media object will be returned in the callback onCreateLocalMedia(SkylinkMedia)
mediaDevice | The Nonnull device that will create local media. |
---|---|
mediaMetadata | The additional info about the media (eg. media's description or user data of the media) This info will be sent to the remote peers as well May be a 'java.lang.String', 'org.json.JSONObject' or 'org.json.JSONArray' or null |
errorCallback | The error callback for the user to know the result of processing Can be null if error processing is not required. |
Create local media using the provided SkylinkConfig.MediaDevice
Valid condition for the process are:
- SkylinkConfig allows to send it.
- Media of the same SkylinkMedia.MediaType
as SkylinkConfig.MediaDevice
is not currently started.
Media will be started by default the SDK that matches the SkylinkConfig.MediaDevice
provided.
If mediaDevice is an VideoDevice, user can input desired width, desired height and desired frameRate for the local video
The SDK will try to create the media that most fit the desired input dimension from the user, but sometimes the actual media
will be different from the input as WebRTC will adjust the video resolution automatically.
Default values from SkylinkConfig will be used if: - For width or height: If any of them has a negative value, both will get default values. - Fps has a negative value.
If successful, local media object will be returned in the callback onCreateLocalMedia(SkylinkMedia)
mediaDevice | The Nonnull device that will create local media. |
---|---|
mediaMetadata | The additional info about the media (eg. media's description or user data of the media) This info will be sent to the remote peers as well May be a 'java.lang.String', 'org.json.JSONObject' or 'org.json.JSONArray' or null |
width | The desired video width in pixel. Input negative value if want to use the default setting |
height | The desired video height in pixel. Input negative value if want to use the default setting |
fps | The desired video frameRate in second. Input negative value if want to use the default setting |
errorCallback | The error callback for the user to know the result of processing Can be null if error processing is not required. |
Create local media using the provided SkylinkConfig.MediaDevice
Valid condition for the process are:
- SkylinkConfig allows to send it.
- Media of the same SkylinkMedia.MediaType
as SkylinkConfig.MediaDevice
is not currently started.
If a custom VideoCapturer is desired, provide an implementation of VideoCapturer.
Otherwise, by default the SDK will provide an appropriate VideoCapturer
that matches the SkylinkConfig.MediaDevice
provided.
If mediaDevice is an VideoDevice, user can input desired width, desired height and desired frameRate for the local video The SDK will try to create the media that most fit the desired input dimension from the user, but sometimes the actual media will be different from the input as WebRTC will adjust the video resolution automatically.
Default values from SkylinkConfig will be used if: - For width or height: If any of them has a negative value, both will get default values. - Fps has a negative value.
If successful, local media object will be returned in the callback onCreateLocalMedia(SkylinkMedia)
mediaDevice | The Nonnull device that will create local media. |
---|---|
mediaMetadata | The additional info about the media (eg. media's description or user data of the media) This info will be sent to the remote peers as well May be a 'java.lang.String', 'org.json.JSONObject' or 'org.json.JSONArray' or null |
customVideoCapturer | Set as null if no custom VideoCapturer is desired.
If provided, the provided SkylinkConfig.MediaDevice
must be the one used by it. |
width | The desired video width in pixel. Input negative value if want to use the default setting |
height | The desired video height in pixel. Input negative value if want to use the default setting |
fps | The desired video frameRate in second. Input negative value if want to use the default setting |
errorCallback | The error callback for the user to know the result of processing Can be null if error processing is not required. |
Destroy a specific local media object by media id
Result will be informed in onDestroyLocalMedia(SkylinkMedia)
if local media
is removed successfully OR onReceiveWarning(SkylinkError, HashMap)
if local media
can not be removed or any error occurs
The destroyed media object is not actually removed from SDK, but the media track is disposed and
media state is changed to UNAVAILABLE
mediaId | the Nonnull id of the local media |
---|---|
errorCallback | The error callback for the user to know the result of processing Can be null if error processing is not required. |
Disconnects from the room we are currently in, all local media and SkylinkConnection instance are still kept locally
Once disconnect is complete,onDisconnectFromRoom(SkylinkEvent, String)
will be triggered.
To reconnect to the room after this, connectToRoom(String, Object, SkylinkCallback)
will have to be called.
To start a new SkylinkConnection or change the config, call init(SkylinkConfig, Context, SkylinkCallback)
and connectToRoom(String, Object, SkylinkCallback)
errorCallback | A callback if unable or unnecessary to disconnect, for e.g., if a disconnect attempt is already in progress, or if we are already disconnected. Can be null if error processing is not required. |
---|
Get the possible capture format(s) of the specified camera device in an array.
Return null if current VideoDevice
is not a defined camera,
or if it was not possible to get the capture formats.
videoDevice | Use null to specific the current VideoDevice. |
---|
Get the CameraEnumerator to use. If Camera2 is supported, use Camera2Enumerator. Otherwise use Camera1Enumerator.
Get the actual Android camera name for the given SkylinkConfig.VideoDevice
.
Get the name of the current camera being used. If no camera or if a custom VideoCapturer is being used, return null.
Return the SkylinkCaptureFormat
that is currently being used by the camera.
Note that the current CaptureFormat may change whenever the
video resolution dimensions change.
Get the current VideoDevice
being used.
If none are active, return null.
Get the encryption secret map set in the SDK, if any.
Get the current resolution of the input video being captured by the local camera or local screen
and the SkylinkCaptureFormat used.
If resolution is available, it will be returned in onObtainInputVideoResolution(int, int, int, SkylinkCaptureFormat)
asynchronously
Note:
- Resolution may not always be available, e.g. if no video is captured or mediaId provided is not existing
- This might be different from the resolution of the video actually sent to Peers as
WebRTC may adjust resolution dynamically to try to match its bandwidth criteria.
mediaId | The Nonnull id of the local media object to get resolution |
---|---|
callback | the Nonnull callback for result if processing is successful or error if processing is failed |
Get our PeerId, or return null if not available. Before connecting to the room, the returned result will be "SelfPeer" After connecting to the room, the returned result will be specific self peer id that was generated by the server
Return a String array of PeerIds of connected Peers, including selfPeer. Size of array is number of Peers connected, including self. PeerId of the local user (i.e. ourselves) is "SelfPeer" if we do not yet have a room based PeerId, for e.g. when we are not connected to the room.
Request for the instantaneous receiving transfer speed(s) of a remote media track, at the moment of request.
It is calculated from the WebRTC provided statistics of the specified media track,
over a short time interval.
Result will be delivered via callback onReceiveTransferSpeed(double)
mediaId | Nonnull id of the remote media object to get receiving speed of transferring |
---|---|
callback | Nonnull result callback for the transfer speed or error asynchronously |
Get the current resolution of the video received from a specific Peer.
If resolution is available, it will be returned in onObtainReceivedVideoResolution(int, int, int)
asynchronously
Note:
- Resolution may not always be available, e.g. if no video is received or mediaId is invalid.
mediaId | The Nonnull id of the remote media object to get resolution |
---|---|
callback | The Nonnull callback for result if processing is successful or the error if processing is failed |
Request for WebRTC statistics of the specified remote media track which we are receiving from remote peer
Result will be delivered via callback onReceiveWebRtcStats(HashMap)
mediaId | Nonnull id of the remote media object to get stats from remote peer |
---|---|
callback | Nonnull result callback for the stats asynchronously |
Provides the room ID of the room currently connected to. This is sometimes also referred to as the meeting ID.
Get the secretId of the secret to use when SDK needs to perform encryption.
Request for the instantaneous sending transfer speed(s) of a local media track to a specific remote peer, at the moment of request.
It is calculated from the WebRTC provided statistics of the specified media track,
over a short time interval.
Result will be delivered via callback
onReceiveTransferSpeed(double)
mediaId | Nonnull id of the local media object to get speed of transferring to the remote peer |
---|---|
remotePeerId | Nonnull id of the remote peer that local media currently streamed to |
callback | Nonnull result callback for the transfer speed or error asynchronously |
Get the current resolution of the video being sent to a specific Peer.
If resolution is available, it will be returned in onObtainSentVideoResolution(int, int, int)
asynchronously
Note:
- Resolution may not always be available, e.g. if no video is sent or remote peer id is invalid.
- This might be different from the resolution of the video actually captured by camera as
WebRTC may adjust resolution dynamically to try to match its bandwidth criteria.
remotePeerId | The Nonnull peerId of the remote Peer from whom we want to get sent video resolution. |
---|---|
mediaId | The Nonnull id of the local media object to get resolution |
callback | The Nonnull callback for result if processing is successful or error if processing is failed |
Request for WebRTC statistics of the specified local media track which streams to a specific remote peer
Result will be delivered via callback onReceiveWebRtcStats(HashMap)
mediaId | Nonnull id of the local media object to get stats from remote peer |
---|---|
remotePeerId | Nonnull id of the remote peer that local media is currently streams to |
callback | Nonnull result callback for the stats asynchronously |
Get a specific SkylinkMedia based on mediaId, applied for both local and remote media
mediaId | The Nonnull id of the media |
---|
Get a list of SkylinkMedia objects based on media type and peer id
mediaType | the type of the media
if null, taken as ALL TYPES including:
AUDIO ,
AUDIO_MIC ,
VIDEO ,
VIDEO_CAMERA ,
VIDEO_SCREEN ,
VIDEO_CUSTOM |
---|---|
peerId | The id of the peer, can be self peer or remote peer if input self peer id, all local media in given type will be returned if input specific remote peer id, all remote media in given type from that remote peer will be returned if input null, all media including local and remote media in given type will be returned |
Gets the current SkylinkState
of the current SkylinkConnection instance.
SkylinkState
or
null if there was error getting SkylinkState
.
Gets the version of this Skylink SDK for Android as a String, for e.g. "0.9.8".
Get the current list of message(s) stored on server.
Notes:
- To use this function, Persistent Message must be active on Temasys console.
- Each message stored correspond to a message sent successfully with
setMessagePersist(boolean)
or the corresponding API from other Skylink SDKs.
callback | Callback for results and/or errors. |
---|
Retrieves the UserInfo object of a Peer, including user data.
peerId | The PeerId of the peer whose UserInfo is to be retrieved, or NULL for self. |
---|
Initialize a SkylinkConnection instance with the specified parameters. Any Listeners set before will be removed (i.e. set to null). Any media resources was used before will be removed to start a new session. Can only be done while disconnected from room.
config | The SkylinkConfig object to configure the necessary information for SDK. |
---|---|
applicationContext | The Android ApplicationContext. |
errorCallback | The callback for error if the process is failed |
Checks if logging is enabled for SDK.
Checks whether the next public server message sent should be persisted,
as described at setMessagePersist(boolean)
.
Check the SDK currently supports for multitracks or not.
Checks if we are currently performing recording. Notes: - Recording status may change immediately after query. - If recording was on and we just tried to stop recording, it would be considered as recording is still on, even if the Recording Server had stopped recording, but whose signal had yet to reach us. This is to avoid accidental recording of unintended material when a user believed that recording had stopped before it actually does.
Checks if the room is locked.
Locks the room if it is not locked
errorCallback | the error callback if the process is failed. For eg, the room is already locked Can be null if error processing is not required. |
---|
Process Android Intent based permission result received by App via Android callback android.app.Activity#onActivityResult(int, int, Intent). The permission request may or may not have been prompted by the Skylink SDK.
requestCode | The requestCode in the Android callback. |
---|---|
resultCode | The resultCode in the Android callback. |
data | The Intent data in the Android callback. |
Process Android Runtime permission result received by App via Android callback android.app.Activity#onRequestPermissionsResult. The permission request may or may not have been prompted by the Skylink SDK.
requestCode | The requestCode in the Android callback. |
---|---|
permissions | The permissions in the Android callback. |
grantResults | The grantResults in the Android callback. |
Refreshes a connection with a specific peer or all connections with peers in room. Able to indicate preference for ICE restart. ICE will only restart if both the Peers of the connection being restarted allow ICE restart. Note that when Skylink Media Relay is active: - Refresh will be done with all Peers, even if a specific remotePeerId was provided. - ICE restart will not occur, even if it was set to true.
remotePeerId | Id of the remote peer to whom we will refresh connection. Use 'null' if refresh is to be done with all our remote peers in the room. |
---|---|
doIceRestart | Specify if ICE restart should be performed. ICE restart is recommended if network conditions had changed, for e.g. a different network is used. |
errorCallback | the callback for error if process is failed if has error in processing, the callback will include the remote peer id that has failed for refreshing Can be null if error processing is not required. |
Call this method to reject the file share request from a remote peer. This can be only process if config has file transfer
remotePeerId | The id of the remote peer that requested to share with us a file. |
---|---|
errorCallback | The error callback if the process failed. |
Sends a byte array to a specified remotePeer or to all remote peers in the room. The byte array cannot be null, and its maximum size is 65456 bytes.
The data transfer can only be processed if config has dataTransfer
Notes: - This operation is currently not supported with Skylink Media Relay. - This operation is currently only supported between Skylink Mobile SDKs (Android and iOS)data | Array of bytes |
---|---|
remotePeerId | remotePeerID of a specified peer or null if sending for all remote peers in the room |
errorCallback | The error callback if the process has error Can be null if error processing is not required. |
Sends request(s) to share file with a specific remote peer or to all remote peers in the same room. Only 1 file may be sent to the same Peer at the same time. Sending and receiving concurrently with a non-Mobile (e.g. Web or C++) Peer is not supported. Filename is the actual filename sent to remote user, may differ from local filename. If filename is null, the actual filename in the filePath will be used.
The file transfer can only be processed if config has fileTransfer
Notes: - This operation is currently not supported with Skylink Media Relay.filePath | The absolute path of the file in the file system |
---|---|
fileName | The name of the file that is to be shared. |
remotePeerId | The id of the remote peer to send the file to. Use 'null' if the file is to be sent to all remote peers in the room. |
errorCallback | The nullable callback for error if processing is failed Can be null if error processing is not required. |
Sends local user data related to oneself, to all remote peers in our room.
localUserData | User defined data relating to the peer like userName. May be a 'java.lang.String', 'org.json.JSONObject' or 'org.json.JSONArray'. |
---|---|
errorCallback | the callback for error if the process is failed Can be null if error processing is not required. |
Sends a user defined message to a specific remote peer or to all remote peers in a direct peer to peer manner. This can be only processed if config has hasP2PMessaging
message | User defined data. May be a 'java.lang.String', 'org.json.JSONObject' or 'org.json.JSONArray'. |
---|---|
remotePeerId | Id of the remote peer to whom we will send a message. Use 'null' if the message is to be sent to all our remote peers in the room. |
errorCallback | the error callback if the process is failed Can be null if error processing is not required. |
Sends a user defined message to a specific remote peer or to all remote peers via a server.
To send an encrypted message, ensure that a valid secret and secretId has been provided
and selected via setEncryptSecretsMap(Map)
and setSelectedSecretId(String)
.
To be able to decrypt this message, the receiver must have the same secret and secretId
set via their setEncryptSecretsMap(Map)
or the corresponding API from other Skylink SDKs.
message | User defined data. May be a 'java.lang.String', 'org.json.JSONObject' or 'org.json.JSONArray'. |
---|---|
remotePeerId | Id of the remote peer to whom we will send a message. Use 'null' if the message is to be public, i.e. broadcast to all remote peers in the room. |
errorCallback | the error callback if can not send message Can be null if error processing is not required. |
Sets the specified data transfer listener object.
dataTransferListener | The data transfer listener object that will receive callbacks related to DataTransfer |
---|
Sets if logging should be enabled for SDK. By default, logging is disabled for released SDK. Enabling logs might be useful for debugging as the SDK will be logged in detail
enableLogs | True/false to enable/disable logs. |
---|
Set a key value map of secretId and encryption secret for generating key for SDK encryption. Each secretId must be a unique and non-empty string. A secret with a secretId that is null or an empty string will not be used.
encryptSecretsMap | a key value map of secretId and encryption secret |
---|
Sets the specified file transfer listener object.
fileTransferListener | The file transfer listener object that will receive callbacks related to FileTransfer |
---|
Change the current captured video track of a specific SkylinkMedia to the specified resolution, and the specified resolution will be set into SkylinkConfig. Non-camera supported resolution can be accepted, but a camera supported resolution will be used when opening camera. There is no guarantee that a specific camera resolution will be maintained as WebRTC may adjust the resolution dynamically to match its bandwidth criteria.
mediaId | Nonnull id of the local media object to set resolution |
---|---|
width | the video width to be set |
height | the video height to be set |
fps | the video frame rate to be set |
errorCallback | the callback for error in processing |
Sets the specified life cycle listener object.
lifeCycleListener | The life cycle listener object that will receive callbacks related to the SDK's Lifecycle. |
---|
Sets the specified media listener object that will receive callbacks related to Media Stream.
Callbacks include those for the local user and remote peers.mediaListener | The media listener object |
---|
Sets whether the next public server message sent should be persisted on Temasys server.
For the message to be persisted (i.e. stored), all of the following are also required:
- Persistent Message is active on Temasys console.
- A valid secretId has been selected via setSelectedSecretId(String)
.
- The message content was successfully encrypted.
Sets the specified messages listener object.
messagesListener | The messages listener object that will receive callbacks related to Message Transmissions. |
---|
Sets the specified OS listener object.
osListener | The OS listener object that will receive callbacks related to Android OS operations. |
---|
recordingListener | The RecordingListener object that will receive callbacks related to recording. |
---|
Sets the specified remote peer listener object.
remotePeerListener | The remote peer listener object that will receive callbacks related to remote Peers. |
---|
Set the secretId of the secret to use when SDK needs to perform encryption. Set to null to not perform encryption. No change in the SDK will occur if an empty string is provided, as that is not a valid secretId.
Start recording if conditions allows: - We must be using Skylink Media Relay. - Recording should not be already started. - We should not have just tried to start recording.
Actual start of recording will be notified via onStartRecording(String)
errorCallback | the error callback if process is failed Can be null if error processing is not required. |
---|
Stop recording if conditions allows: - We must be already be recording. - We should not have just tried to stop recording.
Actual stop of recording will be notified via onStopRecording(String)
errorCallback | the error callback if process is failed Can be null if error processing is not required. |
---|
Call this method to switch between available cameras.
On successful operation, camera switched to will be delivered via callback at
onReceiveInfo(SkylinkInfo, HashMap)
with possible SkylinkInfo
:
-- CAM_OPEN_FRONT
.
-- CAM_OPEN_NON_FRONT
.
errorCallback | The error callback if the process failed. Can be null if error processing is not required. |
---|
Unlocks the room if it is already locked
errorCallback | the error callback if the process is failed. For eg, the room is currently unlocked Can be null if error processing is not required. |
---|