このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

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 (HWHlsClient)

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

This section describes the HWHlsClient 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.

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.

streamStatistic

Specifies whether to enable stream statistics.

enableStreamStateDetection

Enables or disables media stream status detection.

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. Ingest URL that ends with m3u8.
  • options: (optional) 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: prioritizes the display of all video content. 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: prioritizes the filling of the window. 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, such as OPPO, may create a control to overwrite the SDK player, resulting in invalid configuration.

    • muted: (optional) Boolean type. true indicates muted; false indicates unmuted. The default value is false.
    • sessionId: This parameter does not need to be transferred.
    • 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 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: This parameter does not need to be transferred.
    • schedulePolicy: This parameter does not need to be transferred.
    • domainPolicy: This parameter does not need to be transferred.
    • downgradeUrl: This parameter does not need to be transferred.

[Response Parameters]

Promise<void>: returns a Promise object.

switchPlay

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

[Function Description]

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

[Request Parameters]

  • url: (mandatory) String type. Ingest URL that ends with m3u8.
  • options: (optional) 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: prioritizes the display of all video content. 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: prioritizes the filling of the window. 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: This parameter does not need to be transferred.
    • 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: This parameter does not need to be transferred.
    • schedulePolicy: This parameter does not need to be transferred.
    • domainPolicy: This parameter does not need to be transferred.
    • downgradeUrl: This parameter does not need to be transferred.

[Response Parameters]

Promise<void>: returns a Promise object.

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>: result of replay. The options are true (success) and false (failure).

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: result of pausing playback. The options are true (success) and false (failure).

pauseVideo

pauseVideo(): boolean

[Function Description]

This API is not supported.

[Request Parameters]

None

[Response Parameters]

boolean: Only false is returned.

resumeVideo

resumeVideo(): Promise<boolean>

[Function Description]

This API is not supported.

[Request Parameters]

None

[Response Parameters]

boolean: Only false is returned.

pauseAudio

pauseAudio(): boolean

[Function Description]

Pauses the audio playback.

[Request Parameters]

None

[Response Parameters]

boolean: result of pausing 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]

If you set the audio volume, sound will be heard.

[Request Parameters]

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

[Response Parameters]

boolean: whether the audio volume has been set. 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) whether to mute. The value is of the Boolean type. true indicates muting, and false indicates unmuting.

[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 the StreamInterruptRetry type. The definition of StreamInterruptRetry is as follows: {

    enable: The value is of the Boolean type, indicating that 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 pull, 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.

destroyClient

destroyClient(): void

[Function Description]

Destroys a client object.

[Request Parameters]

None

[Response Parameters]

None

fullScreenToggle

fullScreenToggle(isExit: boolean): void

[Function Description]

This API is not supported.

[Request Parameters]

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

[Response Parameters]

None

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback