Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Main Entry (HRTC)

Updated on 2023-11-01 GMT+08:00

This section describes the HRTC APIs of the Web SDK.

Table 1 HRTC APIs

API

Description

checkSystemRequirements

Checks whether the browser is compatible with the SparkRTC Web SDK.

NOTICE:

If the Web SDK version is between 2.0.2 and 2.0.9.300, you need to update it to 2.0.9.301 or later before October 29, 2023. Otherwise, the checkSystemRequirements API will be unavailable. Users of WeChat browsers need to update the SDK version.

VERSION

Obtains the SparkRTC Web SDK version.

getDevices

Obtains the list of media input and output devices.

getCameras

Obtains the camera list.

getMicrophones

Obtains the microphone list.

getSpeakers

Obtains the speaker list.

isScreenShareSupported

Checks whether screen sharing is supported.

createClient

Creates a client object for real-time audio and video calls. One Client object indicates one room.

createStream

Creates a local stream object. Streams are classified into video and presentation. Video refers to streams collected by cameras and microphones. Presentation refers to streams collected from shared screens.

setLogLevel

Sets the log level.

checkSystemRequirements

NOTICE:

If the Web SDK version is between 2.0.2 and 2.0.9.300, you need to update it to 2.0.9.301 or later before October 29, 2023. Otherwise, the checkSystemRequirements API will be unavailable. Users of WeChat browsers need to update the SDK version.

(static) checkSystemRequirements(strictCheckBrowser: boolean): Promise<boolean>

[Function Description]

Checks whether the browser is compatible with the SparkRTC Web SDK.

[Request Parameters]

strictCheckBrowser: (optional) Boolean type. Default value: true. The value true indicates that the mobile browser in the whitelist configured and managed by Huawei is used. The value false indicates that the whitelist is not used. This parameter is added in version 2.0.2.

[Response Parameters]

Promise<boolean>: A Promise object is returned. The value true indicates that the browser is compatible with the SparkRTC Web SDK. If the browser is incompatible with the SparkRTC Web SDK, the corresponding error is returned.

VERSION

VERSION

[Function Description]

Obtains the SparkRTC Web SDK version.

[Request Parameters]

None

[Response Parameters]

string: current SDK version number.

getDevices

(static) getDevices(): Promise<MediaDeviceInfo[]>

[Function Description]

Obtains the list of media input and output devices. The label and deviceId parameters may be empty if the browser is not allowed to access cameras or microphones. It is recommended that you call this API after the browser is allowed to access the devices.

For details about how to grant the permission for accessing cameras or microphones to a browser, see Granting the Permissions of Accessing Cameras or Microphones to a Browser.

[Request Parameters]

None

[Response Parameters]

Promise<MediaDeviceInfo[]>: list of media input and output devices. MediaDeviceInfo is a basic web API.

getCameras

(static) getCameras(): Promise<MediaDeviceInfo[]>

[Function Description]

Obtains the camera list. The label and deviceId parameters may be empty if the browser is not allowed to access cameras. It is recommended that you call this API after the browser is allowed to access the devices.

For details about how to grant the permission for accessing cameras or microphones to a browser, see Granting the Permissions of Accessing Cameras or Microphones to a Browser.

[Request Parameters]

None

[Response Parameters]

Promise<MediaDeviceInfo[]>: camera list. MediaDeviceInfo is a basic web API.

getMicrophones

(static) getMicrophones(): Promise<MediaDeviceInfo[]>

[Function Description]

Obtains the microphone list. The label and deviceId parameters may be empty if the browser is not allowed to access microphones. It is recommended that you call this API after the browser is allowed to access the devices.

For details about how to grant the permission for accessing cameras or microphones to a browser, see Granting the Permissions of Accessing Cameras or Microphones to a Browser.

[Request Parameters]

None

[Response Parameters]

Promise<MediaDeviceInfo[]>: microphone list. MediaDeviceInfo is a basic web API.

getSpeakers

(static) getSpeakers(): Promise<MediaDeviceInfo[]>

[Function Description]

Obtains the speaker list.

[Request Parameters]

None

[Response Parameters]

Promise<MediaDeviceInfo[]>: speaker list. MediaDeviceInfo is a basic web API.

isScreenShareSupported

(static) isScreenShareSupported(): boolean

[Function Description]

Checks whether screen sharing is supported.

[Request Parameters]

None

[Response Parameters]

boolean: true indicates that the function is supported, and false indicates that the function is not supported.

createClient

(static)createClient(config: ClientConfig): Client

[Function Description]

Creates a client object for real-time audio and video calls. A client object can be added to only one room. You can create multiple client objects and add them to multiple rooms respectively.

[Request Parameters]

config: (mandatory) client object configuration. The type is ClientConfig.

ClientConfig is defined as: {
  • appId: (mandatory) app ID. The type is string[128]. Only apps with the same ID can enter the same room for interaction. For details about how to obtain the value of appId, submit a service ticket.
  • domain: (optional) domain name of the server. The type is string[128]. The value must be the same as the valid enterprise domain name registered with the SparkRTC platform. This parameter is mandatory in SDK 1.0+ and is optional in SDK 2.0+.
  • countryCode: (optional) country or region code. The type is string[2]. The value must be an alpha-2 code specified in the ISO 3166-1 standard. This parameter indicates the country or region code of the service access point of the SDK. For example, CN indicates the Chinese mainland, US indicates the United States, and HK indicates Hong Kong, China. For details about how to configure countryCode, see GRS Country Codes. This parameter was added in version 2.0.3 and was mandatory. It has become an optional parameter in version 2.0.7 or later.

}

[Response Parameters]

Client: client object.

createStream

(static) createStream(config: StreamConfig): Stream

[Function Description]

Creates a local stream object.

[Request Parameters]

config: (mandatory) parameters for creating a stream. The type is StreamConfig.

StreamConfig is defined as: {
  • screen: (optional) The type is Boolean. If the value is true, the stream object collects presentation audio and video. Presentation refers to screen sharing streams. The default value is false, indicating that the stream object collects audio and video collected by microphones and cameras.
  • video: (optional) whether to collect video from cameras. The type is Boolean. The default value is false.
  • audio: (optional) whether to collect audio from microphones. The type is Boolean. The default value is false. This parameter is valid only when screen is set to false.
  • microphoneId: (optional) ID of the microphone for audio collection. This parameter is valid only when audio is set to true. The type is string. If this parameter is not passed, the system automatically uses the default value.
  • cameraId: (optional) ID of the camera for video collection. This parameter is valid only when video is set to true. The type is string. If this parameter is not passed, the system automatically uses the default value.
  • facingMode: (optional) This parameter is valid only when video is set to true. user indicates the front-facing camera; environment indicates the rear-facing camera. The type is string.
  • screenAudio: (optional) whether the screen sharing background sound is included. The type is Boolean. The default value is false. This function applies only to Chrome 74 and later versions on Windows. This parameter is added in version 1.4.0.
  • audioSource: (optional) input audio track object. The type is MediaStreamTrack. Specify a sound track. MediaStreamTrack is a basic web API.
  • videoSource: (optional) input video track object. The type is MediaStreamTrack. Specify a video track. MediaStreamTrack is a basic web API.
  • mirror: (optional) whether the local video collected by cameras is mirrored. The type is Boolean. The default value is false.
  • userId: (optional) ID of the user to which the stream belongs. The type is string.

}

[Response Parameters]

Stream: stream object.

CAUTION:
  • There are two methods of capturing video streams:
    • Configure audioSource and videoSource to capture audio and video, respectively. This method does not support high-quality and low-quality streams.
    • Configure audio/microphoneId and video/cameraId/facingMode to capture audio and video, respectively.
  • If no audio or video source is specified, the created stream object does not include audio or video streams and cannot be played.
  • A stream can be either a video stream or presentation stream.
  • If screen sharing background audio is required, set screen and screenAudio to true. This parameter takes effect only in 1.4.0 and later versions.

setLogLevel

(static) setLogLevel(level: LogLevel): void

[Function Description]

Sets the log output level. Logs of the info level are generated by default.

[Request Parameters]

level: (mandatory) log level. The type is LogLevel.

LogLevel indicates the log level. The enumerated values are as follows:

  • none: disabling SDK log print. The type is string.
  • error: enabling the SDK error log level. The type is string.
  • warn: enabling the SDK warning log level. The type is string.
  • info: enabling the SDK information log level. The type is string.
  • debug: enabling the SDK debug log level. The type is string.

[Response Parameters]

None

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback