音视频播放器(基于ijkplayer) 扩展录像、截屏等功能 so文件编译依赖这个仓库
- 使用kotlin和AndroidX编写,支持java使用
- 简单易用支持生命周期感知无需处理so库加载和释放
- RTSP/RTMP 秒开优化
- 支持https openssl 升级至1_1_1k
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.wuhongsheng:wtplayer:-SNAPSHOT'
}
1.布局文件
<RelativeLayout
android:id="@+id/video_parent"
android:background="#00000000"
app:layout_constraintDimensionRatio="w,3:4"
app:layout_constraintTop_toBottomOf="@id/toolbar"
android:layout_width="match_parent"
android:layout_height="0dp">
<com.wt.wtplayer.widget.WtVideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />
</RelativeLayout>
class MainTestActivity : AppCompatActivity() {
private lateinit var mBinding: MainTestActBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mBinding = DataBindingUtil.setContentView(this,
R.layout.main_test_act)
lifecycle.addObserver(mBinding.videoView)
mBinding.videoView.setHudView(mBinding.hudView)
mBinding.tvPlay.setOnClickListener(View.OnClickListener {
if(TextUtils.isEmpty(mBinding.etPath.text)){
Toast.makeText(this,"请输入路径",Toast.LENGTH_SHORT).show()
}else{
var videoPath = mBinding.etPath.text.toString()
mBinding.videoView.setVideoPath(videoPath)
mBinding.videoView.start()
}
})
mBinding.tvPlay.callOnClick()
}
}
- 升级ffmpeg4.0
- 支持https
- 录像支持自定义水印
- 增加投屏功能