CloudHub JSSDK
- Overview
- CloudHubRTC
- CloudHubRTCObject
- Client
- ClientEvent
- ClientLiveTranscoding
- ClientChannelMediaRelayConfig
- Stream
- StreamEvent
- DeviceManager
- constant
CloudHubRTC instructions and interfaces
- CloudHubRTC it is the entry of all the adjustable methods in the JSSDK.
- CloudHubRTC method can be used to create client and stream objects.
- CloudHubRTC methods can also check browser compatibility.
Get the SDK version
Version number of CloudHub JSSDK VERSION: string
CloudHubRTC.VERSION
CloudHubRTC Log module
Log level:
- DEBUG: Output all API log information
- INFO: Output INFO, WARNING and ERROR level log information
- WARNING: Output Warning and Error Level Log Information
- ERROR: Output Error Level Log Information
- NONE: Do not output log information
Log module method
setLogLevel
Method effect: Set the log output level of the SDK.
setLogLevel(level: DEBUG | INFO | WARNING | ERROR | NONE): void
name | type | description |
---|---|---|
level | integer | The 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: Check the JSSDK’s adaptation to the browser you are using
- createClient: Used to create clients, called only once per session
- createStream: Create and return audio and video streaming objects
- getDeviceManager: Get the device management class
- setSdkLogConfig: Set the configuration for sdk internal log printing
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);
})
name | type | description |
---|---|---|
codec | string | Encoding method, encoding method has VP8 and h264 , default is VP8 |
onCallback | function | The callback function, the callback parameters carry Issupport and Errinfo. ** Note: ** Issupport expressed support for True, FALSE said it is not supported. |
Note:
- For some browsers (such as QQ browser, etc.) for some Chrome kernels, we have not been tested for a complete test. If you need to use it, you can try it. In the next several versions, we will gradually complete the adaptation and testing of most mainstream browsers.
- Some browsers are used by the CHROME kernel because the kernel is used, but the SDK may detect is supported (the actual real use is unable to support, such as: no matter how it does not see / hear, etc.), there is no need to recommend Use the browser that is not recommended by the SDK, please see about the browser support Browser support。
createClient
Method effect: used to create a client, only call once in each session.
createClient(config: ClientConfig): Client
// example
CloudHubRTC.createClient(config)
name | type | description |
---|---|---|
config | object | Define 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);
name | type | description |
---|---|---|
spec | object | Define 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});
name | type | description |
---|---|---|
config | object | The SDK internal log is configured as follows: level?:number Set the configuration of the SDK internal log printing. |