- What's New
- Service Overview
-
Billing
- Billing Items
- Basic Service Billing
- Value-added Service Billing
- Billing Modes
- Changing the Billing Option
- Bills
- Arrears
- Billing Termination
-
Billing FAQs
-
Common Cases
- What Do I Need to Pay?
- Do I Need to Buy the CDN Service Before Using Live?
- How Do I Change the Billing Option?
- Do I Need to Delete Resources If I Don't Want to Use Live Any More?
- How Do I View the Usage and Expenditure of Pay-per-Use Live Resources?
- Is Downstream Traffic or Upstream Traffic Billed?
- Will I Be Billed for URL Validation?
- How Is Transcoding Billed?
- Does the Daily Peak Bandwidth Mean the Upstream Bandwidth or Downstream Bandwidth?
- Why Is a Recording Fee Deducted on the First Day of Each Month?
- Arrears
-
Common Cases
- Cloud Live
-
Media Live
- Overview
- Scenarios
- Functions
- Product Advantages
- Constraints
- Getting Started
-
Console Operations
- Prerequisites
- Functions
- Permissions Management
- Domain Name Management
- Channels
- Live Transcoding
- Service Monitoring
- Cloud Resource Authorization
- Tools
- Best Practices
-
Cloud Live API Reference
- Before You Start
- API Overview
- Calling APIs
- Examples
-
Domain Name Management
- Creating a Domain Name
- Deleting a Domain Name
- Modifying a Domain Name
- Querying a Domain Name
- Mapping Domain Names
- Deleting a Domain Name Mapping
- Configuring the Domain Name IPv6 Function
- Querying IP Address Information
- Modifying the Streaming Domain Name Delay
- Querying the Streaming Domain Name Delay
- Modifying the HLS Configuration of a Domain Name
- Querying HLS Configurations of Domain Names
- Modifying Origin Pull Settings
- Querying Origin Pull Settings
- Notification Management
-
Authentication Management
- Configuring a Referer Validation ACL
- Deleting a Referer Validation ACL
- Querying Referer Validation ACLs
- Querying IP Address ACLs
- Modifying an IP Address ACL
- Generating a Signed URL
- Querying Supported Areas of a Streaming Domain Name
- Modifying Supported Areas of a Streaming Domain Name
- Querying the URL Validation Configuration of a Specified Domain Name
- Modifying the URL Validation Configuration of a Specified Domain Name
- Deleting the URL Validation Configuration of a Specified Domain Name
- Snapshot Management
- Recording Management
- Recording Callback Management
- HTTPS Certificate Management
- OBS Bucket Management
- Transcoding Template Management
- Stream Management
-
Statistics Analysis
- Querying Peak Bandwidth
- Querying Total Traffic
- Querying HTTP Status Codes for Pulling Live Streams
- Querying the Duration of Transcoded Outputs
- Querying Recording Channels
- Querying the Number of Snapshots
- Querying Upstream Bandwidth
- Querying the Number of Stream Channels
- Querying the Historical Stream List
- Querying the Playback Profile
- Querying the Distribution of Live Streaming Metrics by Region
- Stream Analytics
- Appendix
- Change History
-
Media Live API Reference
- Before You Start
- API Overview
- Calling APIs
- Examples
-
OTT Channel Management
- Creating an OTT Channel
- Querying Channel Information
- Deleting Channel Information
- Modifying Channel Packaging Information
- Modifying Channel Input Stream Information
- Modifying Channel Recording Information
- Modifying General Channel Information
- Changing the Channel Status
- Modifying Channel Transcoding Template Information
- Appendix
- Change History
- Cloud Live Server SDK Reference
- Low Latency Live Client SDK Reference
- Troubleshooting
Advanced Usage
Overview
Advanced usage covers the following scenarios:
- Scenario 1: Playback
- Scenario 2: Pausing and Resuming Playback
- Scenario 3: Switching to Another Video
- Scenario 4: Setting Full-Screen Playback
- Scenario 5: Muting
- Scenario 6: Stopping Playback
- Scenario 7: Destroying a Player
For details about the complete code in the preceding scenarios, see Advanced Usage. You can copy the code to the local PC for testing.
Scenario 1: Playback
// Playback configuration const options = { // Playback DOM node ID. elementId: 'preview', // URL used after downgrade downgradeUrl: { flvUrl: 'https://xxxx/xx/xx/xx.flv', hlsUrl: 'https://xxxx/xx/xx/xx.m3u8' }, // Video display adaptation objectFit: 'fill' } // Playback const startPlay = function () { playClient.startPlay(url, options) }
Scenario 2: Pausing and Resuming Playback
To pause the playback, call the pause method by referring to pause. To resume the playback, call the resume method by referring to resume.
// Pause the playback. const pauseAction = function () { playClient.pause() } // Resume the playback. const resumeAction = function () { playClient.resume() }
Scenario 3: Switching to Another Video
To quickly switch to another video during playback, call the switchPlay method to transfer the target video URL. See switchPlay.
// Switch to another video. const switchAction = function () { const url = 'a new url' playClient.switchPlay(url) }
Scenario 4: Setting Full-Screen Playback
You can call the fullScreenToggle method to set full-screen playback. See fullScreenToggle.
// Full screen const fullScreenAction = function () { playClient.fullScreenToggle() }
Scenario 5: Muting
You can call the muteAudio method to mute or unmute a video. See muteAudio.
// Mute the video. const muteAction = (() => { let mute = false return function () { mute = !mute playClient.muteAudio(mute) } })()
Scenario 6: Stopping Playback
You can call the stopPlay method to stop playback. This method is different from pause. pause means temporarily stopping video playback, and the playback may be resumed after a short period of time. Stream pull continues but there are no image and sound. stopPlay means interrupting the stream. See stopPlay.
// Stop playback. const stopAction = function () { playClient.stopPlay() }
Scenario 7: Destroying a Player
After the playback task is complete, you can call the destroyClient method to destroy the player. Generally, if you create a player on a page, you can play multiple videos on the page and need to destroy the player when leaving the page. See destroyClient.
// Destroy the player. const destroyAction = function () { playClient.destroyClient() playClient = null }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.