This topic describes the callback and listener interfaces of the mini program SDK.

Contents

API Description Supported earliest version
error Notify the application of an error. 2.5.2
stream-added Notify the application that a remote audio and video stream has been added. 2.5.2
stream-removed Notify the application that the remote audio and video stream has been deleted. 2.5.2
mute-audio Notify the remote user of the application that the audio stream has stopped sending. 2.5.2
mute-video Notify the remote user of the application that it has stopped sending video streams. 2.5.2
unmute-audio Notify the remote user of the application that the audio stream has been resumed. 2.5.2
unmute-video Notify remote users of the application that they have resumed sending video streams. 2.5.2
leave Notify remote users of the application to leave the channel. 2.5.2

Details

  • error: notifies the application of an error.
    on(
      event: "error", 
      callback: (evt: { code: number; reason: string }) => void
    ): void
    Parameter Type Description
    code number The error code. For more information, see Error code.
    reason string The error message returned.
  • stream-added: notifies the application that a remote audio or video stream has been added.
    on(
      event: "stream-added", 
      callback: (evt: { uid: number, displayName: string}) => void
    ): void
    Parameter Type Description
    uid number The UID of the remote user.
    displayName string The name displayed by the remote user.
  • stream-removed: notifies the application that a remote audio or video stream has been deleted.
    on(
      event: "stream-removed", 
      callback: (evt: { uid: number }) => void
    ): void
    Parameter Type Description
    uid number The UID of the remote user.
  • mute-audio: notifies remote users of the application that they have stopped sending audio streams.
    on(
      event: "mute-audio", 
      callback: (evt: { uid: number }) => void
    ): void
    Parameter Type Description
    uid number The UID of the remote user.
  • mute-video: notifies remote users of the application that they have stopped sending video streams.
    on(
      event: "mute-video", 
      callback: (evt: { uid: number }) => void
    ): void
    Parameter Type Description
    uid number The UID of the remote user.
  • unmute-audio: Notify the remote user of the application that the audio stream has resumed sending.
    on(
      event: "unmute-audio", 
      callback: (evt: { uid: number }) => void
    ): void
    Parameter Type Description
    uid number The UID of the remote user.
  • unmute-video: Notify remote users of the application that they have resumed sending video streams.
    on(
      event: "unmute-video", 
      callback: (evt: { uid: number }) => void
    ): void
    Parameter Type Description
    uid number The UID of the remote user.
  • Leave: Notifies remote users of the application to leave the channel.
    on(
      event: "leave", 
      callback: (evt: { uid: number }) => void
    ): void
    Parameter Type Description
    uid number The UID of the remote user.