หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

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

Client Object (HWLLSClient)

Updated on 2025-02-21 GMT+08:00

This section describes the HWLLSClient APIs of the LLL web SDK.

Table 1 HRTC APIs

API

Description

startPlay

Starts playback. The client obtains the corresponding live stream from the server based on the entered URL.

switchPlay

Quickly switches to the next stream.

stopPlay

Stops the playback.

replay

Replays the video.

startPlayCustomize

Customizes the playback.

resume

Resumes the playback.

pause

Pauses the playback.

pauseVideo

Pauses the video playback.

resumeVideo

Resumes the video playback.

pauseAudio

Pauses the audio playback.

resumeAudio

Resumes the audio playback.

setPlayoutVolume

Sets the playback volume.

getPlayoutVolume

Obtains the audio volume.

muteAudio

Mutes a site or all sites.

streamStatistic

Specifies whether to enable stream statistics.

enableStreamStateDetection

Enables or disables media stream status detection.

on

Registers the callback for a client object event.

off

Deregisters the callback for a client object event.

destroyClient

Destroys a client object.

fullScreenToggle

Enables/Disables full-screen display.

startPlay

startPlay(url: string, options: StartPlayOptions): Promise<void>

[Function Description]

Starts playback. The client obtains the corresponding live stream from the server based on the entered URL.

[Request Parameters]

  • url: (mandatory) String type. A streaming URL is in the format of webrtc://{domain}/{AppName}/{StreamName}.
    • webrtc://: The value is fixed, indicating that streams are pulled using WebRTC.
    • domain: indicates the streaming domain name. Use the streaming domain name registered with Huawei Cloud.
    • AppName: indicates the application name. Use the application name registered with Huawei Cloud.
    • StreamName: indicates the stream name, which must be the same as the pushed stream name.
  • options: (mandatory) Playback configuration parameter. The value is of StartPlayOptions type. The definition of StartPlayOptions is as follows: {
    • elementId: (mandatory) indicates the playback DOM ID.
    • objectFit: (optional) String type. Default value: cover. The following enumerated values are supported:
      • contain: preferentially ensures that all video content is displayed. The video is scaled proportionally until one side of the video window is aligned with the window border. If the video size is inconsistent with the display window size, when the aspect ratio is locked and the video is zoomed in or out to fill the window, a black bar is displayed around the zoomed-in or zoomed-out video.
      • cover: preferentially ensures that the window is filled. The video is scaled proportionally until the entire window is filled with video. If the video size is inconsistent with the display window size, the video stream will be cropped or the image will be stretched to fill the display window.
      • fill: The window is filled with video. If the aspect ratio of the video does not match the window, the video will be stretched to fit the window.
        CAUTION:

        The browser on a mobile phone may create a control to overwrite the SDK player, resulting in invalid configuration. For example, this may occur when an HLS/FLV URL is used for playback after downgrade on an OPPO browser.

    • muted: (optional) Boolean type. true indicates muted; false indicates unmuted. The default value is false.
    • sessionId: (optional) String type. Indicates the unified ID of a complete session.
    • showLoading: (optional) Boolean type. Indicates whether to enable the loading display effect. true indicates that the loading display effect is enabled. The default value is false. When this parameter is set to true, the loading effect upon playback start will also be enabled. The loading effect upon buffering during playback needs to be set based on the LOADING_CONFIG in the setParameter API.
      CAUTION:
      • The QQ browser on Android devices does not support this function.
      • You are advised to leave showLoading blank or set it to false.
    • autoPlay: (optional) Boolean type. true indicates that the autoplay function is enabled. false indicates that the autoplay function needs to be manually triggered. The default value is true.
    • poster: (optional) The object definition is as follows: {
      • url: (optional) String type. Sets the complete address of the thumbnail image to be played. The image must be in JPG, PNG, or static GIF format, the size cannot exceed 1 MB, and the resolution cannot exceed 1920 x 1080. The file name cannot contain Chinese characters.
      • mode: (optional) String type. The default value is crop. The following enumerated values are supported: {
        • fill: The window is filled with video. If the aspect ratio of the video does not match the window, the video will be stretched to fit the window.
        • crop: original size of the video thumbnail. If the thumbnail exceeds the playback area, the excess part is cropped. Otherwise, the thumbnail is displayed in the middle of the playback window.

        }

      • startEnable: (optional) Boolean type. Indicates whether to display the thumbnail when the playback starts. The options are true and false. The default value is false. This parameter takes effect only in non-autoplay scenarios.
      • pauseEnable: (optional) Boolean type. Indicates whether to display the thumbnail on the playback page when the video is paused. The options are true and false. The default value is false.

      }

    • webrtcConfig: (optional) WebRTCConfig type. Specifies parameters for pulling streams of a specified media type. WebRTCConfig is defined as follows: {
      • receiveVideo: (optional) Boolean type. Pulls a video for playback. true indicates that a video is pulled for playback, and false indicates that a video is not pulled for playback. The default value is true. This parameter and receiveAudio cannot be set to false at the same time.
      • receiveAudio: (optional) Boolean type. Indicates whether to pull an audio for playback. true indicates that an audio is pulled for playback, and false indicates that an audio is not pulled for playback. The default value is true. This parameter and receiveVideo cannot be set to false at the same time.

    }

    • domainPolicy: (optional) DomainPolicy type. Specifies the policy of an access domain name. This setting takes effect only when schedulePolicy is set to DNS. DomainPolicy is defined as follows: {
      • 0: (optional) Number type. Indicates that the user-defined domain name is used. The default value is 0.
      • 1: (optional) Number type. Indicates that the public access domain name is used.

      }

    • autoDowngrade: (optional) Boolean type. true indicates that automatic downgrade is enabled, and false (default) indicates not.
    • downgradeUrl: (optional) The object definition is as follows: {
      • hlsUrl?: (optional) String type. Identifies the downgraded HLS streaming URL.
      • flvUrl?: (optional) String type. Identifies the downgraded FLV streaming URL.

      }

[Response Parameters]

Promise<void>: returns a Promise object.

CAUTION:

When the LLL service is faulty, the error code HWLLS_BUSINESS_DOWNGRADE can be used to downgrade the playback. For details, see SDK Usage.

switchPlay

switchPlay(url: string, options: StartPlayOptions): Promise<void>

[Function Description]

After the playback has been started, the system quickly switches to the next stream.

[Request Parameters]

  • url: (mandatory) Ingest URL. A streaming URL is in the format of webrtc://{domain}/{AppName}/{StreamName}.
    • webrtc://: The value is fixed, indicating that streams are pulled using WebRTC.
    • domain: indicates the streaming domain name. Use the streaming domain name registered with Huawei Cloud.
    • AppName: indicates the application name. Use the application name registered with Huawei Cloud.
    • StreamName: indicates the stream name, which must be the same as the pushed stream name.
  • options: (optional) Playback configuration parameter. The value is of StartPlayOptions type. If this parameter is not carried, the options data carried in the first playback start request is reused. The definition of StartPlayOptions is as follows: {
    • elementId: (mandatory) indicates the playback DOM ID.
    • objectFit: (optional) String type. Default value: cover. The following enumerated values are supported:
      • contain: preferentially ensures that all video content is displayed. The video is scaled proportionally until one side of the video window is aligned with the window border. If the video size is inconsistent with the display window size, when the aspect ratio is locked and the video is zoomed in or out to fill the window, a black bar is displayed around the zoomed-in or zoomed-out video.
      • cover: preferentially ensures that the window is filled. The video is scaled proportionally until the entire window is filled with video. If the video size is inconsistent with the display window size, the video stream will be cropped or the image will be stretched to fill the display window.
      • fill: The window is filled with video. If the aspect ratio of the video does not match the window, the video will be stretched to fit the window.
    • muted: (optional) Boolean type. true indicates muted; false indicates unmuted. The default value is false.
    • sessionId: (optional) String type. Indicates the unified ID of a complete session.
    • showLoading: (optional) Boolean type. Indicates whether to enable the loading display effect. true indicates that the loading display effect is enabled. The default value is false. When this parameter is set to true, the loading effect upon playback start will also be enabled. The loading effect upon buffering during playback needs to be set based on the LOADING_CONFIG in the setParameter API.
    • autoPlay: (optional) Boolean type. true indicates that the autoplay function is enabled. false indicates that the autoplay function needs to be manually triggered. The default value is true.
    • poster: (optional) The object definition is as follows: {
      • url: (optional) String type. Sets the complete address of the thumbnail image to be played. The image must be in JPG, PNG, or static GIF format, the size cannot exceed 1 MB, and the resolution cannot exceed 1920 x 1080. The file name cannot contain Chinese characters.
      • mode: (optional) String type. The default value is cover. The following enumerated values are supported: {
        • fill: The window is filled with video. If the aspect ratio of the video does not match the window, the video will be stretched to fit the window.
        • crop: original size of the video thumbnail. If the thumbnail exceeds the playback area, the excess part is cropped. Otherwise, the thumbnail is displayed in the middle of the playback window.

        }

      • startEnable: (optional) Boolean type. Indicates whether to display the thumbnail when the playback starts. The options are true and false. The default value is false. This parameter takes effect only in non-autoplay scenarios.
      • pauseEnable: (optional) Boolean type. Indicates whether to display the thumbnail on the playback page when the video is paused. The options are true and false. The default value is false.

      }

    • webrtcConfig: (optional) WebRTCConfig type. Specifies parameters for pulling streams of a specified media type. WebRTCConfig is defined as follows: {
      • receiveVideo: (optional) Boolean type. Pulls a video for playback. true indicates that a video is pulled for playback, and false indicates that a video is not pulled for playback. The default value is true. This parameter and receiveAudio cannot be set to false at the same time.
      • receiveAudio: (optional) Boolean type. Indicates whether to pull an audio for playback. true indicates that an audio is pulled for playback, and false indicates that an audio is not pulled for playback. The default value is true. This parameter and receiveVideo cannot be set to false at the same time.

    }

    • schedulePolicy: (optional) SchedulePolicy type. Specifies the access scheduling policy. The definition of SchedulePolicy is as follows: {
      • DNS: (optional) String type. Indicates that the domain name is resolved by DNS for being accessed. The default value is DNS.
      • HTTPDNS: (optional) String type. Indicates that HTTPDNS is used for the access domain name.

      }

    • domainPolicy: (optional) DomainPolicy type. Specifies the policy of an access domain name. This setting takes effect only when schedulePolicy is set to DNS. DomainPolicy is defined as follows: {
      • 0: (optional) Number type. Indicates that the user-defined domain name is used. The default value is 0.
      • 1: (optional) Number type. Indicates that the public access domain name is used.

      }

[Response Parameters]

Promise<void>: returns a Promise object.

CAUTION:

When the LLL service is faulty, the error code HWLLS_BUSINESS_DOWNGRADE can be used to downgrade the playback. For details, see SDK Usage.

stopPlay

stopPlay(): boolean

[Function Description]

Stops the playback.

[Request Parameters]

None

[Response Parameters]

boolean: result of stopping playback. The options are true (success) and false (failure).

replay

replay(): Promise<boolean>

[Function Description]

Replays the video.

[Request Parameters]

None

[Response Parameters]

Promise<boolean>: replay result. The options are true (success) and false (failure).

startPlayCustomize

startPlayCustomize(url: string, options: StartPlayOptions): Promise<boolean>

[Function Description]

Customizes the playback.

[Request Parameters]

  • url: (mandatory) Ingest URL. Streaming URL, which is a customized URL for playback.
  • options: (optional) Playback configuration parameter. The value is of StartPlayOptions type. If this parameter is not carried, the options data carried in the first playback start request is reused. The definition of StartPlayOptions is as follows: {
    • elementId: (mandatory) indicates the playback DOM ID.
    • objectFit: (optional) String type. Default value: cover. The following enumerated values are supported:
      • contain: preferentially ensures that all video content is displayed. The video is scaled proportionally until one side of the video window is aligned with the window border. If the video size is inconsistent with the display window size, when the aspect ratio is locked and the video is zoomed in or out to fill the window, a black bar is displayed around the zoomed-in or zoomed-out video.
      • cover: preferentially ensures that the window is filled. The video is scaled proportionally until the entire window is filled with video. If the video size is inconsistent with the display window size, the video stream will be cropped or the image will be stretched to fill the display window.
      • fill: The window is filled with video. If the aspect ratio of the video does not match the window, the video will be stretched to fit the window.
    • muted: (optional) Boolean type. true indicates muted; false indicates unmuted. The default value is false.
    • sessionId: (optional) String type. Indicates the unified ID of a complete session.
    • showLoading: (optional) Boolean type. Indicates whether to enable the loading display effect. true indicates that the loading display effect is enabled. The default value is false. When this parameter is set to true, the loading effect upon playback start will also be enabled. The loading effect upon buffering during playback needs to be set based on the LOADING_CONFIG in the setParameter API.
    • autoPlay: (optional) Boolean type. true indicates that the autoplay function is enabled. false indicates that the autoplay function needs to be manually triggered. The default value is true.
    • poster: (optional) The object definition is as follows: {
      • url: (optional) String type. Sets the complete address of the thumbnail image to be played. The image must be in JPG, PNG, or static GIF format, the size cannot exceed 1 MB, and the resolution cannot exceed 1920 x 1080. The file name cannot contain Chinese characters.
      • mode: (optional) String type. The default value is cover. The following enumerated values are supported: {
        • fill: The window is filled with video. If the aspect ratio of the video does not match the window, the video will be stretched to fit the window.
        • crop: original size of the video thumbnail. If the thumbnail exceeds the playback area, the excess part is cropped. Otherwise, the thumbnail is displayed in the middle of the playback window.

        }

      • startEnable: (optional) Boolean type. Indicates whether to display the thumbnail when the playback starts. The options are true and false. The default value is false. This parameter takes effect only in non-autoplay scenarios.
      • pauseEnable: (optional) Boolean type. Indicates whether to display the thumbnail on the playback page when the video is paused. The options are true and false. The default value is false.

      }

    • webrtcConfig: (optional) WebRTCConfig type. Specifies parameters for pulling streams of a specified media type. WebRTCConfig is defined as follows: {
      • receiveVideo: (optional) Boolean type. Pulls a video for playback. true indicates that a video is pulled for playback, and false indicates that a video is not pulled for playback. The default value is true. This parameter and receiveAudio cannot be set to false at the same time.
      • receiveAudio: (optional) Boolean type. Indicates whether to pull an audio for playback. true indicates that an audio is pulled for playback, and false indicates that an audio is not pulled for playback. The default value is true. This parameter and receiveVideo cannot be set to false at the same time.

    }

    • schedulePolicy: (optional) SchedulePolicy type. Specifies the access scheduling policy. The definition of SchedulePolicy is as follows: {
      • DNS: (optional) String type. Indicates that the domain name is resolved by DNS for being accessed. The default value is DNS.
      • HTTPDNS: (optional) String type. Indicates that HTTPDNS is used for the access domain name.

      }

    • domainPolicy: (optional) DomainPolicy type. Specifies the policy of an access domain name. This setting takes effect only when schedulePolicy is set to DNS. DomainPolicy is defined as follows: {
      • 0: (optional) Number type. Indicates that the user-defined domain name is used. The default value is 0.
      • 1: (optional) Number type. Indicates that the public access domain name is used.

      }

[Response Parameters]

Promise<void>: returns a Promise object.

resume

resume(): Promise<boolean>

[Function Description]

Resumes the playback.

[Request Parameters]

None

[Response Parameters]

Promise<boolean>: result of resuming the audio/video playback. The options are true (success) and false (failure).

pause

pause(): boolean

[Function Description]

Pauses the audio/video playback.

[Request Parameters]

None

[Response Parameters]

boolean: playback pause result. The options are true (success) and false (failure).

pauseVideo

pauseVideo(): boolean

[Function Description]

This parameter is used to pause a video. After the video is paused, it freezes.

[Request Parameters]

None

[Response Parameters]

boolean: result of pausing video playback. The options are true (success) and false (failure).

resumeVideo

resumeVideo(): Promise<boolean>

[Function Description]

Resumes the video playback.

[Request Parameters]

None

[Response Parameters]

Promise<boolean>: result of resuming the video playback. The options are true (success) and false (failure).

pauseAudio

pauseAudio(): boolean

[Function Description]

Pauses the audio playback.

[Request Parameters]

None

[Response Parameters]

boolean: result of pausing the audio playback. The options are true (success) and false (failure).

resumeAudio

resumeAudio(): Promise<boolean>

[Function Description]

Resumes the audio playback.

[Request Parameters]

None

[Response Parameters]

Promise<boolean>: result of resuming the audio playback. The options are true (success) and false (failure).

setPlayoutVolume

setPlayoutVolume(volume: number): boolean

[Function Description]

Sets the audio volume. This API is not supported on iOS.

[Request Parameters]

volume: (mandatory) audio volume. The value is a number ranging from 0 to 100.

[Response Parameters]

boolean: whether the operation is successful. The options are true (success) and false (failure).

getPlayoutVolume

 getPlayoutVolume(): number

[Function Description]

Obtains the audio volume.

[Request Parameters]

None

[Response Parameters]

number: volume value. The value ranges from 0 to 100.

muteAudio

muteAudio(isMute: boolean): void

[Function Description]

Mutes.

[Request Parameters]

  • isMute: (mandatory) indicates whether the device is muted. The value is of the Boolean type. true indicates that the device is muted, and false indicates that the device is unmuted.

[Response Parameters]

None

streamStatistic

streamStatistic(enable: boolean, interval: number): void

[Function Description]

Specifies whether to enable stream statistics.

[Request Parameters]

  • enable: (mandatory) Specifies whether to enable stream statistics. The value is of the Boolean type. The value true indicates that stream statistics are enabled.
  • interval: (mandatory) Specifies the statistics interval, in seconds. The value is a number ranging from 1 to 60. The default value is 1.

[Response Parameters]

None

enableStreamStateDetection

enableStreamStateDetection(enable: boolean, interval: number, interruptRetry:StreamInterruptRetry): boolean

[Function Description]

Enables or disables media stream status detection. After the function is enabled, the system can detect whether the stream has been interrupted at the stream push device.

[Request Parameters]

  • enable: (mandatory) whether to enable media stream status detection. The value is of the Boolean type. true indicates enabled; false (default value) indicates disabled.
  • interval: (mandatory) Specifies the interval in seconds. The value is a number ranging from 1 to 60. This parameter is used to determine when there is no media stream. The default value is 3 (recommended).
  • interruptRetry: (optional) Parameter for configuring playback retry upon stream interruption. The value is of StreamInterruptRetry type. The definition of StreamInterruptRetry is as follows: {

    enable: The value is of the Boolean type. Attempt for automatically resuming playback is enabled after stream interruption. The default value is false, indicating that attempt for automatically resuming playback is disabled.

    retryInterval: retry interval for stream pulling, in seconds. The value type is number. The value ranges from 10 to 60 and defaults to 30.

    retryTimes: maximum number of retry times for resuming playback. The value type is number. The minimum value is 1 and the default value is 30.

    }

[Response Parameters]

boolean: whether the operation is successful. The options are true (success) and false (failure).

CAUTION:

The QQ browser on Android devices does not support this function.

on

on(event: string, handler: function, withTimeout?: boolean): void

[Function Description]

Registers the callback for a client object event.

[Request Parameters]
  • event: (mandatory) event name. The type is string. For details, see HWLLSClientEvent.
  • handler: (mandatory) event processing method. The type is function.
  • withTimeout: (optional) indicates whether a timeout error is reported. The value is of the Boolean type.

[Response Parameters]

None

off

off(event: string, handler: function): void

[Function Description]

Deregisters the callback for a client object event.

[Request Parameters]
  • event: (mandatory) event name. The type is string. For details, see HWLLSClientEvent.
  • handler: (mandatory) event processing method. The type is function.

[Response Parameters]

None

destroyClient

destroyClient(): void

[Function Description]

Destroys a client object.

[Request Parameters]

None

[Response Parameters]

None

fullScreenToggle

fullScreenToggle(isExit: boolean): void

[Function Description]

Enables/Disables full-screen display.

[Request Parameters]

isExit: (mandatory) Boolean type. The default value is false.

[Response Parameters]

None

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback