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
DEFAULTThe 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.
FITMake the video fit the view and keep the ratio in at least 1 dimension (width or height)
FILLZoom the video and do not keep the ratio to fit the view in both width and height
FIXED_WIDTHMake the video fit the view width and keep the ratio
FIXED_HEIGHTMake the video fit the view height and keep the ratio
ZOOMZoom the video and keep the ratio to fit the view in both width and height