Polyv Help Center

Help Center

12. Setting the Logo

Updated: 2023-04-17 15:27:58

The logo setting functionality is implemented through PolyvPlayerLogoView, which is located under the com.easefun.polyvsdk.player package in the demo layer.

Usage: Import PolyvPlayerLogoView -> Add PolyvPlayerLogoView to the PolyvVideoView layout -> Call the addLogo method of PolyvPlayerLogoView.


1 PolyvPlayerLogoView Methods

addLogo(LogoParam logoParam)

1.2 Removing All Logos

removeAllLogo()

2 LogoParam Methods

2.1 Setting Logo Width and Height

Logo width and height support two units: pixels and percentage, e.g., 100px or 10%. Width and height must use the same unit.

The logo image maintains its original aspect ratio. If logo_width and logo_height do not match the original image's aspect ratio, the image will not be stretched. The smaller side is used as the reference, and the other side is scaled proportionally.

When the player size changes (e.g., portrait/landscape switching, floating window switching, or three-screen primary/secondary screen switching):

  • If the logo width and height are in pixels, the size is not adjusted (even if the floating window might be completely covered by the logo).
  • If in percentage, the logo size is automatically adjusted based on the player's width and height multiplied by the percentage.
setWidth(float width)
setHeight(float height)

2.2 Setting the Logo Image

You can set the logo image using a resource ID or a URL. If both are provided, the resource ID takes precedence. If the image cannot be retrieved, the video continues playing without displaying the logo.

setResId(int resId)
setResUrl(String resUrl)

2.3 Setting Logo Offset

Logo offset supports two units: pixels and percentage.

  • If the unit is px, the offset is applied in pixels relative to the corresponding edge of the selected initial position.
  • If the unit is percentage, the offset is applied as a percentage of the corresponding edge relative to the selected initial position, with a value range of (0, 100).
setOffsetX(float offsetX)
setOffsetY(float offsetY)

2.4 Setting Logo Position

Logo position values: 0 Do not display 1 Top-left 2 Top-right (default) 3 Bottom-left 4 Bottom-right

setPos(int pos)
联系客服,在线咨询