Skip to content

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.

License

Notifications You must be signed in to change notification settings

Tans5/tMediaPlayer

Repository files navigation

Summary

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.

Screenshots

Demo Apks:
arm64-v8a
armeabi-v7a
x86_64
x86

Usage

Add dependency

dependencies {
	 // ...
    implementation 'io.github.tans5:tmediaplayer:1.2.0'
    // ...
}

Play a local media file

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()

Ascii art image filter

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)

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published