Skip to content

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

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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • object.success callback function parameters: Parameter Object res

    PropertiesTypeDescription
    tempImagePathstringTemporary path of the image file
    widthstringImage width
    heightstringImage height

.toggleTorch

TIP

The API usage is as follows: LivePusherContext.toggleTorch(Object object)

  • Functional description: Toggle flashlight

  • Parameters and descriptions: Object object

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    urlString-YesAdd background mixing resource address
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    positionNumber-YesBackground sound progress, unit: seconds
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    volumeNumber-YesVolume, range is 0.0-1.4
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    volumeNumber-YesVolume, range is 0.0-1.4
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    audioReverbTypeNumber-YesMix type, 0 to 6 correspond to 'Close reverb', 'KTV', 'Small room', 'Great hall', 'Muffled', 'Loud', 'Magnetic'
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • object.success callback function parameters: Object res。

    PropertiesTypeDescription
    tempFilePathStringTemporary 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    directionNumber0NoSet the direction when full screen
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
    • Legal value of object.direction
    ValueDescription
    0Normal vertical
    9094 degrees counterclockwise of the screen
    -9094 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback 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

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • object.success callback function parameters: Object res。

    PropertiesTypeDescription
    tempFilePathStringTemporary path of the image file
    widthStringImage width
    heightStringImage height

.stop

TIP

The API usage is as follows: LivePlayerContext.stop(Object object)

  • Functional description: Stop

  • Parameters and descriptions: Object object

    PropertiesTypeDefault valueRequiredDescription
    successFunction-NoCallback function for successful interface call
    failFunction-NoCallback function for failed interface call
    completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)