Add video calling to your android application using just a few lines of code
- Add jitpack in project-level build.gradle
allprojects {
repositories {
// ...
maven { url 'https://jitpack.io' }
}
}
- Add this in app-level build.gradle inside android {}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
- Add dependency in app-level build.gradle
implementation 'com.github.ashiqursuperfly:AndroidEasyVidChat:x.x.x'
Make sure you use the latest release version, this project adheres to Semantic Versioning.
- Add this in manifest
<activity android:name="com.ashiqurrahman.easyvidchat.ui.CallActivity" />
- request required permissions
VidChat.requestVideoChatPermissions( this, PERMISSION_REQUEST_CODE)
- after the user has accepted all the permissions, just a single line of code initiates video calling intent
startActivityForResult(VidChat.getCallingIntent(activity, roomID), CALL_REQUEST_CODE) // send an unique roomID for your call, the receiver user must also connect on the same roomID
- similarly if you want screen sharing
VidChatConfig.screenCaptureEnabled = true
startActivityForResult(VidChat.getCallingIntent(activity, roomID), CALL_REQUEST_CODE) // send an unique roomID for your call, the receiver user must also connect on the same roomID
- receive results after the call is disconnected
override fun onActivityResult(
requestCode: Int,
resultCode: Int,
data: Intent?
) {
super.onActivityResult(requestCode, resultCode, data)
if(requestCode == CALL_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
Toast.makeText(this, "Call Success, OnActivityResult, Code:$resultCode", Toast.LENGTH_LONG).show()
} else {
Toast.makeText(this, "Call Failed/Disconnected, OnActivityResult, Code:$resultCode", Toast.LENGTH_LONG).show()
}
}
}
Please go through the Wiki for advanced usages, contributing guide and more.
This project makes use of the apprtc project and some of the source codes in chromium.googlesource