Android media player library base on FFmpeg 7.0.1. Support single image frame load, subtitle render, video hw decode and ascii art image filter.
Demo Apks:
arm64-v8a
armeabi-v7a
x86_64
x86
dependencies {
// ...
implementation 'io.github.tans5:tmediaplayer:1.2.0'
// ...
}
val mediaPlayer = tMediaPlayer()
// set media file and use hardware decode.
mediaPlayer.prepare("xxxxx.mp4", true)
// if prepare success, play it.
mediaPlayer.play()
// if you need display images, add a tMediaPlayerView to render it.
mediaPlayer.attachPlayerView(playerView)
When you don't need player, remenber to release it.
mediaPlayer.release()
Basic media player methods.
mediaPlayer.setListener(object : tMediaPlayerListener {
/**
* Player state update
*/
override fun onPlayerState(state: tMediaPlayerState) {
}
/**
* Play progress update
*/
override fun onProgressUpdate(progress: Long, duration: Long) {
}
})
mediaPlayer.play()
mediaPlayer.pause()
mediaPlayer.seekTo(0)
mediaPlayer.stop()
Open ascii art image filter
playerView.enableAsciiArtFilter(true)
Ascii art image filter settings
val filter = playerView.getAsciiArtImageFilter()
filter.setCharLineWidth(128)
filter.reverseChar(true)
filter.reverseColor(true)
filter.colorFillRate(1.0f)