Polyv Help Center

Help Center

Connected Mic User List

Updated: 2026-01-19 09:16:42

This document primarily describes the connected mic user list and the API documentation for the node ConnectMicItem.

1. Connected Mic List

1.1 Get Connected Mic List

Ways for viewers to watch the connected mic user stream:

  • When a viewer is not connected to the mic, they watch via mixed streaming;
  • When a viewer connects to the mic, they watch via RTC stream;

When a viewer goes on stage or a connected mic user stream joins, the ConnectMicEvents.ConnectMicListChange event is triggered. Developers can obtain the connected mic user list through the event's connectMicList or getConnectMicList method.

API Method: getConnectMicList(): ConnectMicItem[]

Return Value Description: ConnectMicItem[] type

Example:

watchCore.connectMic.eventEmitter.on(ConnectMicEvents.ConnectMicListChange, () => {
  const connectMicList = watchCore.connectMic.getConnectMicList();
  console.log('连麦用户列表', connectMicList);
});

2. Connected Mic User Node

2.1 ConnectMicItem Properties

Property Name Description Type
streamId User stream ID string
isLocal Whether it is a local push stream boolean
isSelf Whether it is the current user boolean
isMaster Whether it is the first screen boolean
isTeacher Whether it is the lecturer boolean
nickname User nickname string
pic User avatar string
userType User identity ChatUserType
isAudioMuted Whether the microphone is muted boolean
currentVolume Current volume (0 ~ 1) number
isVideoMuted Whether the camera is off boolean
mirrorEnabled Whether mirroring is enabled (only valid for local stream) boolean
currentConnectMicType The user's connection method ConnectMicType
isPlayFail Whether auto-play failed boolean
isAudience Whether it is audience mode, only pulling the lecturer's stream boolean

Example:

// 获取连麦用户列表
const connectMicList = watchCore.connectMic.getConnectMicList();
connectMicList.forEach((micItem) => {
  console.log('连麦用户流 id', micItem.streamId);
  console.log('该用户是否关闭摄像头', micItem.isVideoMuted);
  console.log('该用户是否关闭麦克风', micItem.isAudioMuted);
});

2.2 Publish Local Stream

When the lecturer approves the viewer's mic connection request, the connection status changes to publishing ConnectMicStatus.Applying. The connection module will call back the ConnectMicEvents.ConnectMicListChange event for the connected mic user list change. Developers can publish the local stream using the publishStream method of the connected mic user node.

Upon successful stream publishing, the ConnectMicEvents.PublishStreamSuccess event will be triggered.

API Method: publishStream(options: PublishStreamOptions): void

Parameter Description:

  • options: Publishing parameters, PublishStreamOptions type, required. Detailed type description is as follows:
Parameter Name Description Type Required Default Value
element Render node HTMLDivElement Yes -
control Control bar boolean No true
fit Video crop mode ConnectMicFitType No ConnectMicFitType.Cover
profile Publishing profile StreamProfile No '240p'

Example:

watchCore.connectMic.eventEmitter.on(ConnectMicEvents.ConnectMicListChange, ({ connectMicList }) => {
  // 遍历连麦用户列表
  connectMicList.forEach((micItem) => {
    // 本地流节点
    if (micItem.isLocal) {
      // 推送本地流
      micItem.publishStream({
        element: 'NodeElement',
      });
    }
  });
});

2.3 Subscribe to Connected Mic User Stream

When a viewer goes on or off stage, the connection module will call back the ConnectMicEvents.ConnectMicListChange event for the connected mic user list change. Developers can listen to this event to obtain the new connected mic user list and subscribe to the connected mic user stream using the subscribeStream method of the connected mic user node.

API Method: subscribeStream(options: SubscribeSteamOptions): void

Parameter Description:

  • options: Subscription stream parameters, SubscribeSteamOptions type, required. Detailed type description is as follows:
Parameter Name Description Type Required Default Value
element Render node HTMLDivElement Yes -
control Control bar boolean No true
fit Video crop mode ConnectMicFitType No ConnectMicFitType.Cover
video Pull video stream boolean No true
audio Pull audio stream boolean No true

Example:

watchCore.connectMic.eventEmitter.on(ConnectMicEvents.ConnectMicListChange, ({ connectMicList }) => {
  // 遍历连麦用户列表
  connectMicList.forEach((micItem) => {
    if (micItem.isLocal) {
      // 推送本地流
      micItem.publishStream({
        element: 'NodeElement',
      });
    } else {
      // 订阅连麦流
      micItem.subscribeStream({
        element: 'NodeElement',
      });
    }
  });
});

2.4 Resume Connected Mic Stream Playback

After an auto-play failure, the user node isPlayFail will change to true. At this point, a play button needs to be displayed. When the user clicks the play button, this method can be called to resume stream playback.

API Method: resumeStream(): void

Example:

if (micItem.isPlayFail) {
  console.log('显示节点的播放按钮');
}

document.querySelector('播放按钮选择器').addEventListener('click', () => {
  // 恢复播放
  micItem.resumeStream();
});

2.5 Remove Connected Mic User Stream

When the connected mic node is destroyed, the removeStream method needs to be called to remove the user stream. Taking the destruction of a Vue component as an example:

API Method: removeStream(): void

Example:

export default {
  beforeDestroy() {
    this.micItem.removeStream();
  }
};

3. Other

3.1 Publishing Profile

profile Optional values for the publishing profile and their corresponding configuration parameters:

Publishing Profile Resolution Frame Rate Bitrate
240p 320 × 240 20 200
240p_1 320 × 240 15 200
240p_4 424 × 240 15 220
480p 640 × 480 15 500
480p_1 640 × 480 15 500
480p_8 848 × 480 15 610
720p 1280 × 720 15 1130
720p_1 1280 × 720 15 1130
720p_2 1280 × 720 30 2000
720p_5 960 × 720 15 910
1080p_1 1920 × 1080 15 1500
1080p_2 1920 × 1080 25 1500
联系客服,在线咨询