tencent cloud

Feedback

Real-time audio/video

Last updated: 2024-11-21 18:48:12

    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)
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support