tencent cloud

Tencent Cloud Super App as a Service

Release Notes and Announcements
Announcement: Tencent Cloud Mini Program Platform Renamed to Tencent Cloud Super App as a Service on January 2, 2025
Console Updates
Android SDK Updates
iOS SDK Updates
Flutter SDK Updates
IDE Updates
Base Library Updates
Product Introduction
Overview
Strengths
Use Cases
Purchase Guide
Billing Overview
Pay-As-You-Go Billing
Renewal Guide
Service Suspension Instructions
Getting Started
Plan Management
Overview
Console Account Management
Storage Configuration
Acceleration Configuration
Branding Configurations
Platform Features
Console Login
Users and Permission System
Mini Program Management
Mini Game Management
Superapp Management
Commercialization
Platform Management
User Management
Team Management
Operations Management
Security Center
Code Integration Guide
Getting Demo and SDK
Android
iOS
Flutter
Superapp Server
GUID Generation Rules
Mini Program Development Guide
Mini Program Introduction and Development Environment
Mini Program Code Composition
Guide
Framework
Components
API
Server Backend
JS SDK
Base Library
IDE Operation Instructions
Mini Game Development Guide
Guide
API
Server Backend
Practice Tutorial
Mini Program Login Practical Tutorial
Mini Program Subscription Message Practical Tutorial
Payment Practical Tutorial
Ad Integration Practical Tutorial
Mini Game Subscription Message Practical Tutorial
API Documentation
History
Introduction
API Category
Making API Requests
Operation Management APIs
User Management APIs
Team Management APIs
Sensitive API-Related APIs
Role Management APIs
Platform Management APIs
Other Console APIs
Mini Program or Mini Game APIs
Management-Sensitive APIs
Global Domain Management APIs
Superapp APIs
Data Types
Agreements
Service Level Agreement
Data Processing and Security Agreement
SDK Privacy Policy Module
SDK Data Processing and Security Agreement Module

Real-Time Audio/Video

PDF
Focus Mode
Font Size
Last updated: 2025-03-25 18:15:55

createLivePusherContext

This method is used via LivePusherContext wx.createLivePusherContext().
Note:
Support for this feature starts from the base library 1.4.96. Compatibility measures are required for earlier versions.
Feature Description: Creates a LivePusherContext object.
Return Value: LivePusherContext.

LivePusherContext

LivePusherContext instance, obtainable via wx.createLivePusherContext.
The LivePusherContext is uniquely bound within the page to the live-pusher component, operating the corresponding live-pusher component.

.start

This method is used via LivePusherContext.start(Object object).
Feature Description: Starts streaming while simultaneously activating camera preview.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.stop

This method is used via LivePusherContext.stop(Object object).
Feature Description: Stops streaming and concurrently camera preview.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.pause

This method is used via LivePlayerContext.pause(Object object).
Feature Description: Pauses streaming.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.resume

This method is used via LivePusherContext.resume(Object object).
Feature Description: Resumes streaming.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.switchCamera

This method is used via LivePusherContext.switchCamera(Object object).
Feature Description: Switches between front and rear cameras.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.snapshot

This method is used via LivePusherContext.snapshot(Object object).
Feature Description: Snapshot.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
object.success callback function: arguments Object res
Attribute
Type
Description
tempImagePath
string
Temporary path for image files
width
string
Width of the image
height
string
height of the image

.toggleTorch

This method is used via LivePusherContext.toggleTorch(Object object).
Feature Description: Switches to flashlight.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.playBGM

This method is used via LivePusherContext.playBGM(Object object).
Feature Description: Plays background sound.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
url
String
-
Yes
Resource address for adding background mix.
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.stopBGM

This method is used via LivePusherContext.stopBGM(Object object).
Feature Description: Stops background sound.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.pauseBGM

This method is used via LivePusherContext.pauseBGM(Object object).
Feature Description: Pauses background sound.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.resumeBGM

This method is used via LivePusherContext.resumeBGM(Object object).
Feature Description: Resumes background sound.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.setBGMPosition

This method is used via LivePusherContext.setBGMPosition(Object object).
Feature Description: Sets the progress of the background sound.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
position
Number
-
Yes
Background sound progress, measured in seconds.
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.setMICVolume

This method is used via LivePusherContext.setMICVolume(Object object).
Feature Description: Sets the microphone volume.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
volume
String
-
Yes
Volume level, ranging from 0 to 1.
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.setBGMVolume

This method is used via LivePusherContext.setBGMVolume(Object object).
Feature Description: Sets the background volume.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
volume
String
-
Yes
Volume level, ranging from 0 to 1.
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.setAudioReverbType

This method is used via LivePusherContext.setAudioReverbType(Object object).
Feature Description: Sets the mix type.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
audioReverbType
Number
-
Yes
Mix type, 0 to 6 correspond to "Reverb off", "KTV", "Small room", "Large hall", "Deep", "Resonant", "Magnetic", respectively.
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.startPreview

This method is used via LivePusherContext.startPreview(Object object).
Feature Description: Enables camera preview.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.stopPreview

This method is used via LivePusherContext.stopPreview(Object object).
Feature Description: Disables camera preview.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.startAudioRecord

This method is used via LivePusherContext.startAudioRecord(Object object).
Feature Description: Starts audio recording, which will automatically terminate when LivePusherContext.stopAudioRecord is actively invoked, or when the recording exceeds one minute.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.stopAudioRecord

This method is used via LivePusherContext.stopAudioRecord(Object object).
Feature Description: Terminates audio recording.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
Parameters for object.success callback function: Object res.
Attribute
Type
Description
tempFilePath
String
Temporary path of audio recording file (local path)

createLivePlayerContext

This API is used via LivePlayerContext wx.createLivePlayerContext(string id, Object this).
Note:
Support for this feature starts from the base library 1.4.96. Compatibility measures are required for earlier versions.
Feature Description: Creates a LivePlayerContext object.
Parameter and Description:
string id, the ID of the live-player component;
Object this, "this" of the current component instance under custom components, used to operate the live-player component within.
Return Value: LivePlayerContext.

LivePlayerContext

.exitfullscreen

This method is used via LivePlayerContext.exitFullScreen(Object object).
Feature Description: Exits full screen.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.mute

This method is used via LivePlayerContext.mute(Object object).
Feature Description: Mute.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.pause

This method is used via LivePlayerContext.pause(Object object).
Feature Description: Pause.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.play

This method is used via LivePlayerContext.play(Object object).
Feature Description: Play.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.requestFullScreen

This method is used via LivePlayerContext.requestFullScreen(Object object).
Feature Description: Enters full screen.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
direction
Number
0
No
Set the direction during full screen.
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
Valid values of object.direction.
Value
Description
0
Normal vertical orientation
90
Screen rotating 90 degrees counterclockwise
-90
Screen rotating 90 degrees clockwise

.resume

This method is used via LivePlayerContext.resume(Object object).
Feature Description: Restoration.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

.snapshot

This method is used via LivePlayerContext.snapshot(Object object).
Feature Description: Screenshot.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
Parameters for object.success callback function: Object res.
Attribute
Type
Description
tempImagePath
String
Temporary path of the image file
width
String
Image width
height
String
Image height

.stop

This method is used via LivePlayerContext.stop(Object object).
Feature Description: Halt.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
success
Function
-
No
Callback Function of Successful Interface Call
fail
Function
-
No
Callback Function of Failing Interface Call
complete
Function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback