CloudHub Docs
Download Documents

RTC


CloudHub JSSDK

CloudHubRTC instructions and interfaces

Get the SDK version

Version number of CloudHub JSSDK VERSION: string

CloudHubRTC.VERSION

CloudHubRTC Log module

Log level:

Log module method

setLogLevel

Method effect: Set the log output level of the SDK.

setLogLevel(level: DEBUG | INFO | WARNING | ERROR | NONE): void
nametypedescription
levelintegerThe level of log filtering set by the developer, in the default is INFO

debug

Print the debug log

debug(...args): void

eg:

CloudHubRTC.Logger.debug("this is debug log");

info

Print the info log.

info(...args): void

eg:

CloudHubRTC.Logger.info("this is info log");

warning

Print the warning log.

warning(...args): void

eg:

CloudHubRTC.Logger.warning("this is warning log");

error

Print the error log.

error(...args): void

eg:

CloudHubRTC.Logger.error("this is error log");

CloudHubRTC method

Methods are summarized below:

checkSystemRequirements

Method effect: Check the adaptation of the JSSDK to the browser you are using. You need to call this method before you create a client object (createClient) to check the adaptation of the JSSDK to the browser you are using.

checkSystemRequirements(codec: string, onCallback:function): void

// example
CloudHubRTC.checkSystemRequirements('vp8', function(issupport, errinfo){
    console.info('checkSystemRequirements', issupport, errinfo);
})
nametypedescription
codecstringEncoding method, encoding method has VP8 and h264, default is VP8
onCallbackfunctionThe callback function, the callback parameters carry Issupport and Errinfo. ** Note: ** Issupport expressed support for True, FALSE said it is not supported.

Note:

createClient

Method effect: used to create a client, only call once in each session.

createClient(config: ClientConfig): Client

// example
CloudHubRTC.createClient(config)
nametypedescription
configobjectDefine the client’s properties ClientConfig.
ClientConfig: See more CloudHubRTC Data object document of ClientConfig description

createStream

Method effect: Create and return to audio and video stream objects. Make sure that the stream of the same stream ID is destroyed before the stream is created.

createStream(spec: StreamSpec): Stream

// example
CloudHubRTC.createStream(spec);
nametypedescription
specobjectDefine the properties of the audio and video stream objects.
StreamSpec: See more CloudHubRTC Data object document StreamSpec description
Notice:StreamSpec Type and uid are required if CreateStream returns undefined if not filled.

getDeviceManager

Get the device management class.

getDeviceManager(): DeviceManager

// example
CloudHubRTC.getDeviceManager();

setSdkLogConfig

Set the configuration of the SDK internal log printing.

setSdkLogConfig(config:object): void

// example
CloudHubRTC.setSdkLogConfig({level: CloudHubRTC.Logger.INFO});

nametypedescription
configobjectThe SDK internal log is configured as follows:
level?:number Set the configuration of the SDK internal log printing.