Important parameters

更新时间:
复制 MD 格式

This topic describes the Config parameters that the Start and Join components require to initiate or join a video call.

Basic parameters

Parameter name

Parameter type

Required

Description

userId

String

Yes

The user ID.

appId

String

Yes

The miniapp ID.

roomId

String

No

The channel ID.

token

String

No

The channel token.

resolution

int

No

The video definition. 0: 640 × 360, 1: 960 × 540, 2: 1280 × 720. The default value is 2.

fps

int

No

The video frame rate. Valid values are 15 and 30. The default value is 30.

streamInfo

Different channels require different parameters. The following table lists the parameters for the mPaaS channel, which is the only channel currently supported.

Channel

Parameter

Parameter Type

Required

Description

mPaaS

signature

String

Yes

Required for Ant Group internal domains and mPaaS.

serverUrl

String

Yes

The server URL.

For the mPaaS channel, the serverUrl is fixed: wss://cn-hangzhou-mrtc.cloud.alipay.com/ws.

workspaceId

String

Yes

Required when you use mPaaS.

bizName

String

Yes

Required when you use mPaaS.

subBiz

String

Yes

Required when you use mPaaS.

Interface display

Parameter name

Type

Required

Description

displayInfo

String

No

The configuration for the interface display. This parameter is optional.

showFullScreen

boolean

No

Specifies whether to display the shared screen in full-screen mode on a PC. Default: false (immersive mode). Set to true to display the entire screen.

callPage_visible

boolean

No

Specifies whether to show the call answering page. Default: true (show). Set to false to hide the page.

calling_information

String

No

The text to display on the call answering interface.

end_information

String

No

The text to display on the call termination interface.

pusher_visible

boolean

No

Specifies whether to display the pusher view. Use this parameter with enableCamera for audio-only streaming scenarios.

pusher_isMini

boolean

No

Specifies whether to display the pusher view as a small window. Default: false. This parameter is mutually exclusive with player.isMini. Only one can be true.

player_visible

boolean

No

Specifies whether the item is displayed.

player_isMini

boolean

No

Specifies whether to display the player view as a small window. Default: true. This parameter is mutually exclusive with pusher.isMini. Only one can be true.

hangup_visible

boolean

No

Specifies whether to display the Close button. Default: true. The button is hidden only when the value is false.

mute_visible

boolean

No

Specifies whether to display the Mute button. Default: true. The button is hidden only when the value is false.

screenshot_visible

boolean

No

Specifies whether to display the Screenshot button. Default: true. The button is hidden only when the value is false.

enableCamera_visible

boolean

No

Specifies whether to display the Enable Camera button. Default: true. The button is hidden only when the value is false.

switchCamera_visible

boolean

No

Specifies whether to display the Switch Camera button. Default: true. The button is hidden only when the value is false.

switchScreenCapture_visible

boolean

No

Specifies whether to display the screen sharing button. Default: true. The button is hidden only when the value is false.

users_visible

boolean

No

Specifies whether to display the user list. Default: true. The list is hidden only when the value is false.

users_name

string

Yes

The username to display on the interface. This has a higher priority than the outer `users` parameter.

users_avatar

string

Yes

The user profile picture to display on the interface. This has a higher priority than the outer `users` parameter.

users_name

string

No

The username to display on the interface.

users_avatar

string

No

The user profile picture to display on the interface.

controlInfo_enableCamera

boolean

No

Specifies whether to enable the camera on startup.

Config parameters

{
  userId,  // User ID
  appId,   // Miniapp ID
    
  roomId?, // Channel ID. Not required for creation, optional for joining.
  token?,  // Channel token. Not required for creation, required for joining.

  resolution?: 2, // Video definition. 0: 640 * 360, 1: 960 * 540, 2: 1280 * 720. Default: 2.
  fps?: 30,       // Video frame rate. 15 or 30. Default: 30.

  streamInfo: {
    // Pass different parameters based on the channel. Currently, only the mPaaS channel is supported.
    //  - mPaaS
    //    - signature
    //    - serverUrl (wss://cn-hangzhou-mrtc.cloud.alipay.com/ws)
    //    - workspaceId
    //    - bizName
    //    - subBiz
    
    // Signature
    signature,           // Required for Ant Group internal domains and mPaaS.
        
    // mPaaS
    bizName: '',         // Required when you use mPaaS.
    subBiz: '',          // Required when you use mPaaS.
    workspaceId: '',     // Required when you use mPaaS.
    serverUrl: 'wss://cn-hangzhou-mrtc.cloud.alipay.com/ws'
    // For the mPaaS channel, the serverUrl above is fixed.
    
  },
    
  displayInfo?: { // Configuration for the interface display. Optional.
    showFullScreen?: { // Full-screen display
        visible: false // Default: false (immersive mode). Set to true to display the entire screen.
    },
    callPage?: { // Call answering page switch
        visible: true // Default: true (show). Set to false to hide.
    },
    calling?: {
      information?: string // Text to display on the call answering interface.
    },
    
    end?: {
      information?: string // Text to display on the call termination interface.
    },
      
    answer?: {
      pusher?: {
        visible?: boolean,  // Specifies whether to display. Use with enableCamera for audio-only streaming.
        isMini?: boolean   // Display as a small window. Default: false. Mutually exclusive with player.isMini. Only one can be true.
      },
      
      player?: {
        visible?: boolean,  // Specifies whether to display.
        isMini?: boolean   // Display as a small window. Default: true. Mutually exclusive with pusher.isMini. Only one can be true.
      },
      
      actions?: {
        
        hangup?: {
          visible?: boolean // Display the Close button. Default: true. Hidden only if false.
        },
      
        mute?: {
          // Note: This controls the audio capture of the client, not the phone's volume.
          visible?: boolean // Display the Mute button. Default: true. Hidden only if false.
        },
          
        screenshot?: {
          visible?: boolean // Display the Screenshot button. Default: true. Hidden only if false.
        },
          
        enableCamera?: {
          visible?: boolean // Display the Enable Camera button. Default: true. Hidden only if false.
        },
        
        switchCamera?: {
          visible?: boolean // Display the Switch Camera button. Default: true. Hidden only if false.
        },
        switchScreenCapture?:{
           visible?: boolean // Display the screen sharing button. Default: true. Hidden only if false.
        }
      },
        
      users?: {
        visible?: boolean, // Display the user list. Default: true. Hidden only if false.
        
        // User configuration. This has a higher priority than the outer users parameter.
        config: [userId]: {
          name: string,   // Username to display on the interface.
          avatar: string // User profile picture to display on the interface.
        }
      }
    },
      
    users?: {
      [userId]: {
        name: string,   // Username to display on the interface.
        avatar: string // User profile picture to display on the interface.
      }
    }
  },
    
  controlInfo?: {
    enableCamera?: boolean  // Enable the camera on startup.
  },

  extraInfo?: {}
}

RTC interface

// Import the plugin.
const { rtc } = requirePlugin('rtc');

rtc.disableCamera() // Disables the camera.
rtc.enableCamera() // Enables the camera.
rtc.hangup() // Hangs up the call.
rtc.mute() // Mutes the audio.
rtc.unmute() // Unmutes the audio.
rtc.setFullScreen(true/false) // Toggles full-screen display.
rtc.snapshot() // Takes a screenshot.
rtc.startScreenCapture() // Starts screen sharing.
rtc.stopScreenCapture() // Stops screen sharing.
rtc.switchCamera() // Switches between the front and rear cameras.