Real-Time Audio And Video
createLivePusherContext
TIP
The API usage is as follows: LivePusherContext wx.createLivePusherContext()
TIP
Basic library 1.4.96 starts to support, and lower versions need to be compatible
- Functional description: create. live-pusher Context LivePusherContext Object
- Return value: LivePusherContext
LivePusherContext
LivePusherContext instance, which can be used wx.createLivePusherContext
LivePusherContext and the only one in the page live-pusher Component binding, operation corresponding live-pusher Component
.start
TIP
The API usage is as follows: LivePusherContext.start(Object object)
Functional description: Start streaming and start camera preview at the same time
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.stop
TIP
The API usage is as follows: LivePusherContext.stop(Object object)
Functional description: Stop streaming and stop camera preview at the same time
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.pause
TIP
The API usage is as follows: LivePlayerContext.pause(Object object)
Functional description: Pause streaming
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.resume
TIP
The API usage is as follows: LivePusherContext.resume(Object object)
Functional description: Resume streaming
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.switchCamera
TIP
The API usage is as follows: LivePusherContext.switchCamera(Object object)
Functional description: Switch front and back cameras
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.snapshot
TIP
The API usage is as follows: LivePusherContext.snapshot(Object object)
Functional description: Snapshot
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure) object.success callback function parameters: Parameter Object res
Properties Type Description tempImagePath string Temporary path of the image file width string Image width height string Image height
.toggleTorch
TIP
The API usage is as follows: LivePusherContext.toggleTorch(Object object)
Functional description: Toggle flashlight
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.playBGM
TIP
The API usage is as follows: LivePusherContext.playBGM(Object object)
Functional description: Play background sound
Parameters and descriptions: Object object
Properties Type Default value Required Description url String - Yes Add background mixing resource address success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.stopBGM
TIP
The API usage is as follows: LivePusherContext.stopBGM(Object object)
Functional description: Stop background sound
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.pauseBGM
TIP
The API usage is as follows: LivePusherContext.pauseBGM(Object object)
Functional description: Pause background sound
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.resumeBGM
TIP
The API usage is as follows: LivePusherContext.resumeBGM(Object object)
Functional description: Resume background sound
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.setBGMPosition
TIP
The API usage is as follows: LivePusherContext.setBGMPosition(Object object)
Functional description: Set background sound progress
Parameters and descriptions: Object object
Properties Type Default value Required Description position Number - Yes Background sound progress, unit: seconds success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.setMICVolume
TIP
The API usage is as follows: LivePusherContext.setMICVolume(Object object)
Functional description: Set the microphone volume
Parameters and descriptions: Object object
Properties Type Default value Required Description volume Number - Yes Volume, range is 0.0-1.3 success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.setBGMVolume
TIP
The API usage is as follows: LivePusherContext.setBGMVolume(Object object)
Functional description: Set background sound volume
Parameters and descriptions: Object object
Properties Type Default value Required Description volume Number - Yes Volume, range is 0.0-1.3 success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.setAudioReverbType
TIP
The API usage is as follows: LivePusherContext.setAudioReverbType(Object object)
Functional description: Set the mixing type
Parameters and descriptions: Object object
Properties Type Default value Required Description audioReverbType Number - Yes Mix type, 0 to 6 correspond to 'Close reverb', 'KTV', 'Small room', 'Great hall', 'Muffled', 'Loud', 'Magnetic' success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.startPreview
TIP
The API usage is as follows: LivePusherContext.startPreview(Object object)
Functional description: Enable camera preview
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.stopPreview
TIP
The API usage is as follows: LivePusherContext.stopPreview(Object object)
Functional description: Disable camera preview
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.startAudioRecord
TIP
The API usage is as follows: LivePusherContext.startAudioRecord(Object object)
Functional description: Start recording, when LivePusherContext.stopAudioRecord is actively called, or the recording exceeds 1 minute, the recording will be automatically ended.
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.stopAudioRecord
TIP
The API usage is as follows: LivePusherContext.stopAudioRecord(Object object)
Functional description: Stop recording
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure) object.success callback function parameters: Object res。
Properties Type Description tempFilePath String Temporary path of the recording file (local path)
createLivePlayerContext
TIP
The API usage is as follows: LivePlayerContext wx.createLivePlayerContext(string id, Object this)
TIP
Basic library 1.4.96 starts to support, and lower versions need to be compatible
- Functional description: Create a live-pusher context LivePusherContext object
- Parameters and descriptions:
- string id,live-player Component id
- Object this,Under the custom component, this of the current component instance, to operate the component live-player Component
- Return value: LivePlayerContext
LivePlayerContext
.exitfullscreen
TIP
The API usage is as follows: LivePlayerContext.exitFullScreen(Object object)
Functional description: Exit full screen.
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.mute
TIP
The API usage is as follows: LivePlayerContext.mute(Object object)
Functional description: Mute
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.pause
TIP
The API usage is as follows: LivePlayerContext.pause(Object object)
Functional description: Pause
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.play
TIP
The API usage is as follows: LivePlayerContext.play(Object object)
Functional description: Play
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.requestFullScreen
TIP
The API usage is as follows: LivePlayerContext.requestFullScreen(Object object)
Functional description: Enter full screen.
Parameters and descriptions: Object object
Properties Type Default value Required Description direction Number 0 No Set the direction when full screen success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure) - Legal value of object.direction
Value Description 0 Normal vertical 90 93 degrees counterclockwise of the screen -90 93 degrees clockwise of the screen
.resume
TIP
The API usage is as follows: LivePlayerContext.resume(Object object)
Functional description: Restore
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)
.snapshot
TIP
The API usage is as follows: LivePlayerContext.snapshot(Object object)
Functional description: Take a screenshot
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure) object.success callback function parameters: Object res。
Properties Type Description tempFilePath String Temporary path of the image file width String Image width height String Image height
.stop
TIP
The API usage is as follows: LivePlayerContext.stop(Object object)
Functional description: Stop
Parameters and descriptions: Object object
Properties Type Default value Required Description success Function - No Callback function for successful interface call fail Function - No Callback function for failed interface call complete Function - No Callback function for interface call completion (executed regardless of success or failure)