Effortless Danmaku Integration on Android with XDanmuku Library

The XDanmuku library unfolds as a treasure for Android developers, simplifying the integration of Danmaku (bullet screen) features within applications. The brainchild of hust201010701, this ongoing project is crafted with Kotlin and shared under the Apache 2.0 license.

XDanmuku is a rich reservoir of features:

  • It welcomes a variety of Danmaku styles including text, images, and videos.
  • The library enables Danmaku animations such as floating, scaling, and rotating.
  • It supports Danmaku layering and region control to manage the display area.
  • Interactive Danmaku is at your fingertips, fostering user engagement.

Kickstart your XDanmuku journey by importing the library as follows:

dependencies {
  implementation 'com.github.hust201010701:xdanmuku:1.0.0'
}

Next, create a Danmaku container and set its parameters to fit your needs:

// Create a Danmaku container
val danmukuContainer = XDanmukuContainer(context)

// Set the container parameters
danmukuContainer.setWidth(width)
danmukuContainer.setHeight(height)
danmukuContainer.setAutoPlay(true)

// Add a Danmaku
danmukuContainer.addDanmuku(Danmuku("Hello, world!"))

Venture further by customizing Danmaku style and controlling its animations:

// Set Danmuku style
danmukuContainer.setDanmukuStyle(DanmukuStyle.TEXT)

// Control Danmaku animations
danmukuContainer.setDanmukuSpeed(100)
danmukuContainer.setDanmukuScale(2.0f)

// Add Danmaku events
danmukuContainer.setOnDanmukuClickListener {
  // Danmaku click event
}

With a myriad of styles and interactive features, XDanmuku is adaptable for developers of all skill levels, albeit a less active community and sparse documentation are its Achilles' heel.