Skip to main content

Carousel layout

The Carousel layout displays videos horizontally in a single row.

val cfBuilder = ViewConfig.Builder(this) // `this` is a context
cfBuilder.videoSource(source)
val carouselLoCf = ShortVideoCarouselLayout.createDefaultConfig(this)
cfBuilder.layoutConfig(carouselLoCf)
shortVideoView.init(cfBuilder.build())

Some attributes that can be customized include:

  • Item background color
  • Spacing between items

For Carousel items, you can customize the following UI components/attributes:

  • Video title text view (the layoutGravity attr is ignored)
  • Item's corner radius
  • Progress bar
  • Play/pause, mute button
  • Video thumbnail scale mode
  • Video scale mode
val loCf = ShortVideoCarouselLayout.createDefaultConfig(this)
loCf.itemConfiguration?.let { cf ->
cf.videoScaleMode = BlsPlayerScaleMode.DEFAULT
}

Supported video scale modes:

Scale modeDescription
DEFAULT

The SDK will choose the best scale mode bases on video/device orientation. This is the default value and it is recommended to use this mode.

FIT

Make the video fit the view and keep the ratio in at least 1 dimension (width or height)

FILL

Zoom the video and do not keep the ratio to fit the view in both width and height

FIXED_WIDTH

Make the video fit the view width and keep the ratio

FIXED_HEIGHT

Make the video fit the view height and keep the ratio

ZOOM

Zoom the video and keep the ratio to fit the view in both width and height