A simple Media recorder button having recording and play / pause feature with some nice animations.
Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.khizarhayat:MediaRecorder:Tag'
}
Simple use in your fragment like below
<com.khizar.mediarecorder.RecorderPlayer
android:id="@+id/recorderPlayer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Pass your fragment in build method like below
binding.recorderPlayer.build(this)
Your fragment can implement interface if you need to do any task in result like show error or submit recording to your server
RecorderCallBack
MPCallBack