callstats WebRTC analytic library for Android.
implementation "io.callstats:callstats:<version>"
Library will requires WebRTC library to be available at runtime.
implementation "org.webrtc:google-webrtc:<version>"
For more information https://webrtc.org/native-code/android/
callstats = Callstats(
context,
appID, // Application ID from Callstats
localID, // current user ID
deviceID, // unique device ID
jwt, // jwt from server for authentication
alias) // (Optional) user alias
When starting the call, call startSession
with room identifier
callstats.startSession(room)
These events need to be forwarded to the library in order to start tracking the call. Add followings into your WebRTC PeerConnection.Observer
For example:
override fun onIceConnectionChange(state: PeerConnection.IceConnectionState) {
callstats.reportEvent(peerId, OnIceConnectionChange(state))
}
override fun onIceGatheringChange(state: PeerConnection.IceGatheringState) {
callstats.reportEvent(peerId, OnIceGatheringChange(state))
}
override fun onSignalingChange(state: PeerConnection.SignalingState) {
callstats.reportEvent(peerId, OnSignalingChange(state))
}
And when call finished
callstats.stopSession()
You can take a look at how to send more events in demo application.