Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / communicate-dev / src / main / java / com / vayunmathur / communicate / data / signal / call / SignalCallSignaling.kt
SignalCallSignaling.kt34 lines · 1.2 KiBRaw
| 1 | package com.vayunmathur.communicate.data.signal.call |
| 2 | |
| 3 | import org.webrtc.PeerConnection |
| 4 | |
| 5 | /** Identity key pair for SRTP binding. */ |
| 6 | data class IdentityKeyPairBytes(val local: ByteArray, val remote: ByteArray) |
| 7 | |
| 8 | /** How call signaling reaches the network, and how call state reaches the app. */ |
| 9 | interface SignalCallSignaling { |
| 10 | /** Send one `CallMessage` to [aci]. [deviceId] is null when the message should be broadcast. */ |
| 11 | suspend fun sendCallMessage( |
| 12 | aci: String, |
| 13 | deviceId: Int?, |
| 14 | message: SignalCallMessage, |
| 15 | urgent: Boolean, |
| 16 | ): Boolean |
| 17 | |
| 18 | /** The identity keys RingRTC binds the SRTP key derivation to. */ |
| 19 | suspend fun identityKeys(aci: String): IdentityKeyPairBytes? |
| 20 | |
| 21 | /** The peer turned their camera on or off. */ |
| 22 | fun onRemoteVideo(enabled: Boolean) |
| 23 | |
| 24 | /** The peer started or stopped sharing their screen. */ |
| 25 | fun onRemoteScreenShare(enabled: Boolean) |
| 26 | |
| 27 | /** |
| 28 | * TURN/STUN relays for the call. Without them only host candidates are available, so a call fails |
| 29 | * behind NAT. |
| 30 | */ |
| 31 | suspend fun iceServers(): List<PeerConnection.IceServer> |
| 32 | |
| 33 | fun onCallStateChanged(aci: String, callId: Long, state: SignalCallManager.CallState, isVideo: Boolean) |
| 34 | } |