Skip to content

Instantly share code, notes, and snippets.

View cnrture's full-sized avatar
🥳
Perfect

Caner Türe cnrture

🥳
Perfect
View GitHub Profile
//forEachIndexed, forEach ile aynı işi yapıyor. Sadece index değerini de alıyor.
//forEachIndexed does the same thing as forEach. It just takes the index value.
val list = listOf("a", "b", "c")
list.forEachIndexed { index, s ->
println("foreachindexed -> $index: $s")
}
------------------------------------------------------------------------------------------------
onIceCandidateReceivedCallback = {
Log.d(
SIGNALING_LISTENER_TAG,
"handlingSignalingClient: onIceCandidateReceivedCallback called"
)
webRtcClient.addIceCandidate(it)
},
private val mCallsCandidatesSnaphostListener =
OnSnapshotListener<CallsCandidates> { cloudDBZoneSnapshot, e ->
e?.let {
Log.w(TAG, "onSnapshot: " + e.message)
return@OnSnapshotListener
}
val snapshot = cloudDBZoneSnapshot.snapshotObjects
val callsCandidatesTemp = arrayListOf<CallsCandidates>()
fun addIceCandidate(iceCandidate: IceCandidate) = peerConnection?.addIceCandidate(iceCandidate)
fun sendIceCandidateModelToUser(iceCandidate: IceCandidate, isJoin: Boolean) = runBlocking {
Log.d(TAG, "sendIceCandidateModelToUser: called")
val type: String = when (isJoin) {
true -> Constants.USERTYPE.ANSWER_USER.name
false -> Constants.USERTYPE.OFFER_USER.name
}
val callsCandidates = CallsCandidates()
callsCandidates.uuid = UUID.randomUUID().toString()
callsCandidates.meetingID = meetingID
onIceCandidateCallback = {
signalingClient.sendIceCandidateModelToUser(it, isJoin)
webRtcClient.addIceCandidate(it)
},
onAnswerReceivedCallback = {
Log.d(
SIGNALING_LISTENER_TAG,
"handlingSignalingClient: onAnswerReceivedCallback called"
)
webRtcClient.setRemoteDescription(it)
runOnUiThread {
binding.clVideoLoading.gone()
handleRing(binding.clVideoLoading.isVisible)
handler?.postDelayed(runnable, 0)
fun setRemoteDescription(sessionDescription: SessionDescription) =
peerConnection?.setRemoteDescription(SdpObserverImpl(), sessionDescription)
onOfferReceivedCallback = {
Log.d(
SIGNALING_LISTENER_TAG,
"handlingSignalingClient: onOfferReceivedCallback called"
)
webRtcClient.setRemoteDescription(it)
webRtcClient.answer()
},
package com.hms.quickline.presentation.call.webrtc
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.pm.PackageManager
import android.media.AudioDeviceInfo
import android.media.AudioManager
import android.media.AudioManager.OnAudioFocusChangeListener