Polyv Help Center

Help Center

WeChat Mini Program Live Player Component Parameters

Updated: 2026-11-10 17:15:28

Configuration Parameters

<plv-live-player
  config="{{ config }}"
  muted="{{ muted }}"
>
</plv-live-player>

Parameter List

config

Type: PlayerConfig Description: Player configuration parameters, including configuration information related to video playback. ps: To play using only the video component, you need to configure the forceVideo: true parameter.

controlSlots

Type: Array<ControlSlotTypes> Description: Custom control slots, used to customize the player's control elements.

<plv-live-player
  config="{{ config }}"
  controlSlots="{{ [ 'skin-play', 'skin-pause' ] }}"
>
  <!-- 自定义播放按钮样式 -->
  <view
    slot="skin-play"
    style="background: url('https://xxx/diy-play-icon.png');"
  ></view>

  <!-- 自定义暂停按钮样式 -->
  <view
    slot="skin-pause"
    style="background: url('https://xxx/diy-pause-icon.png');"
  ></view>
</plv-live-player>

autoplay

Type: boolean Description: Whether to automatically play the video.

muted

Type: boolean, default value: false. Standalone component property, not placed in config.

Used for muted preview on the homepage. Set to true before the first mount to pass the muted state in when the player is created; dynamically updating this property will not rebuild the player or re-authenticate. This property is used for live streaming, playback, and warm-up videos.

<polyv-live-player config="{{ playerConfig }}" muted="{{ muted }}" />
Page({
  data: { muted: true }, // 首次挂载即静音
  toggleMuted() {
    this.setData({ muted: !this.data.muted });
  },
});

polyv-live-player is the plugin component alias declared by the host; custom components use the same property.

  • Normal playback and information preloading (preload) follow muted.
  • Pre-initialization (prewarm) is always muted while inactive; after successfully calling activate(), it follows the current muted. If it is true, it remains muted after activation; if it is false, the sound is restored.
  • If this property is not passed, the original behavior is retained. The WeChat live streaming plugin supports this property starting from version 1.3.11.

vodSetting

Type: VodSetting Description: Playback-related configuration parameters, including information related to playback videos.

pipMode

Type: PictureInPictureMode Description: Picture-in-picture (small window playback) mode.

object-fit

Type: 'contain' | 'fillCrop', default value: contain.

Used to set how the video image fills the player container. Before use, confirm that the integrated custom component package or plugin version supports this property.

Value Description
contain Scale proportionally and display the full image. If the image and container have different aspect ratios, black bars may appear.
fillCrop Scale proportionally and fill the container, cropping the part of the image that exceeds the container without stretching the video.

Set this property on the player component, not in config:

<plv-live-player
  config="{{ playerConfig }}"
  object-fit="fillCrop"
/>

When integrating the plugin, set the same property on the player component declared on the page (for example, <polyv-live-player>).

To switch dynamically, use object-fit="{{ objectFit }}" and update the property value through the page's setData:

this.setData({ objectFit: 'fillCrop' }); // 切换为等比裁切铺满
this.setData({ objectFit: 'contain' }); // 切换为完整显示

Switching the fill mode does not require resetting config. This property applies to live streaming, playback, and warm-up videos; warm-up images are not affected. When playing with native video, fillCrop is mapped to cover.

min-cache / max-cache

Both parameters are optional standalone component properties and are not placed in config.

Property Type Default Value Description
min-cache number 1 Minimum buffer for native live-player, in seconds.
max-cache number 3 Maximum buffer for native live-player, in seconds.

The parameter meanings are consistent with WeChat native live-player.

<plv-live-player
  config="{{ playerConfig }}"
  min-cache="{{ minCache }}"
  max-cache="{{ maxCache }}"
/>

In the page data, you can set minCache: 1 and maxCache: 3, update them through setData, and there is no need to reset config. When using the plugin, set the same set of properties on the player component declared on the page (for example, <polyv-live-player>), and confirm that the referenced plugin version supports these two parameters.

Only takes effect for live streaming played using native live-player, and does not affect playback, warm-up, or live streaming played using video (such as forceVideo or .m3u8 addresses).

Increasing the buffer time helps resist network fluctuations but increases playback latency. Adjust according to network conditions and business requirements; buffer time is not equal to end-to-end latency, and adjusting these two parameters will not switch the playback mode.

FAQ

After setting fillCrop, why may black bars still appear?

fillCrop scales and crops according to the overall aspect ratio of the video image and cannot identify or guarantee removal of black bars already present within the video source. If the black bars are already encoded in the video, you need to adjust the streaming or video production settings.

Does switching the fill mode require reinitializing the player?

No. Simply update the component's object-fit property; there is no need to modify config.

联系客服,在线咨询
在线咨询