@capgo/capacitor-stream-call 0.0.62 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,11 +21,19 @@ import android.view.View
|
|
|
21
21
|
import android.view.ViewGroup
|
|
22
22
|
import android.view.WindowManager
|
|
23
23
|
import android.widget.FrameLayout
|
|
24
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
25
|
+
|
|
24
26
|
import androidx.compose.runtime.collectAsState
|
|
27
|
+
import androidx.compose.runtime.derivedStateOf
|
|
28
|
+
import androidx.compose.runtime.getValue
|
|
29
|
+
import androidx.compose.runtime.remember
|
|
30
|
+
import androidx.compose.ui.Modifier
|
|
31
|
+
import androidx.compose.ui.draw.clip
|
|
25
32
|
import androidx.compose.ui.platform.ComposeView
|
|
26
33
|
import androidx.core.app.ActivityCompat
|
|
27
34
|
import androidx.core.content.ContextCompat
|
|
28
35
|
import androidx.core.view.isVisible
|
|
36
|
+
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|
29
37
|
import com.getcapacitor.BridgeActivity
|
|
30
38
|
import com.getcapacitor.JSArray
|
|
31
39
|
import com.getcapacitor.JSObject
|
|
@@ -50,6 +58,10 @@ import io.getstream.android.video.generated.models.VideoEvent
|
|
|
50
58
|
import io.getstream.log.Priority
|
|
51
59
|
import io.getstream.video.android.compose.theme.VideoTheme
|
|
52
60
|
import io.getstream.video.android.compose.ui.components.call.activecall.CallContent
|
|
61
|
+
import io.getstream.video.android.compose.ui.components.call.renderer.FloatingParticipantVideo
|
|
62
|
+
import io.getstream.video.android.compose.ui.components.call.renderer.ParticipantVideo
|
|
63
|
+
import io.getstream.video.android.compose.ui.components.call.renderer.RegularVideoRendererStyle
|
|
64
|
+
import io.getstream.video.android.compose.ui.components.video.VideoScalingType
|
|
53
65
|
import io.getstream.video.android.core.Call
|
|
54
66
|
import io.getstream.video.android.core.CameraDirection
|
|
55
67
|
import io.getstream.video.android.core.GEO
|
|
@@ -58,6 +70,7 @@ import io.getstream.video.android.core.StreamVideo
|
|
|
58
70
|
import io.getstream.video.android.core.StreamVideoBuilder
|
|
59
71
|
import io.getstream.video.android.core.call.CallType
|
|
60
72
|
import io.getstream.video.android.core.events.ParticipantLeftEvent
|
|
73
|
+
import io.getstream.video.android.core.internal.InternalStreamVideoApi
|
|
61
74
|
import io.getstream.video.android.core.logging.LoggingLevel
|
|
62
75
|
import io.getstream.video.android.core.notifications.NotificationConfig
|
|
63
76
|
import io.getstream.video.android.core.notifications.NotificationHandler
|
|
@@ -285,6 +298,7 @@ public class StreamCallPlugin : Plugin() {
|
|
|
285
298
|
}
|
|
286
299
|
}
|
|
287
300
|
|
|
301
|
+
@OptIn(InternalStreamVideoApi::class)
|
|
288
302
|
private fun setupViews() {
|
|
289
303
|
val context = context
|
|
290
304
|
val originalParent = bridge?.webView?.parent as? ViewGroup ?: return
|
|
@@ -316,9 +330,51 @@ public class StreamCallPlugin : Plugin() {
|
|
|
316
330
|
VideoTheme {
|
|
317
331
|
val activeCall = streamVideoClient?.state?.activeCall?.collectAsState()?.value
|
|
318
332
|
if (activeCall != null) {
|
|
333
|
+
val participants by activeCall.state.participants.collectAsStateWithLifecycle()
|
|
334
|
+
val sortedParticipants by activeCall.state.sortedParticipants.collectAsStateWithLifecycle(emptyList())
|
|
335
|
+
val callParticipants by remember(participants) {
|
|
336
|
+
derivedStateOf {
|
|
337
|
+
if (sortedParticipants.size > 6) {
|
|
338
|
+
sortedParticipants
|
|
339
|
+
} else {
|
|
340
|
+
participants
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
val currentLocal by activeCall.state.me.collectAsStateWithLifecycle()
|
|
346
|
+
|
|
319
347
|
CallContent(
|
|
320
348
|
call = activeCall,
|
|
321
|
-
onBackPressed = { /* Handle back press if needed */ }
|
|
349
|
+
onBackPressed = { /* Handle back press if needed */ },
|
|
350
|
+
videoRenderer = { videoModifier, videoCall, videoParticipant, videoStyle ->
|
|
351
|
+
ParticipantVideo(
|
|
352
|
+
modifier = videoModifier,
|
|
353
|
+
call = videoCall,
|
|
354
|
+
participant = videoParticipant,
|
|
355
|
+
style = videoStyle,
|
|
356
|
+
actionsContent = {_, _, _ -> {}}
|
|
357
|
+
)
|
|
358
|
+
},
|
|
359
|
+
floatingVideoRenderer = { call, parentSize ->
|
|
360
|
+
FloatingParticipantVideo(
|
|
361
|
+
call = call,
|
|
362
|
+
participant = currentLocal!!,
|
|
363
|
+
style = RegularVideoRendererStyle().copy(isShowingConnectionQualityIndicator = false),
|
|
364
|
+
parentBounds = parentSize,
|
|
365
|
+
videoRenderer = { _ ->
|
|
366
|
+
ParticipantVideo(
|
|
367
|
+
modifier = Modifier
|
|
368
|
+
.fillMaxSize()
|
|
369
|
+
.clip(VideoTheme.shapes.dialog),
|
|
370
|
+
call = call,
|
|
371
|
+
participant = currentLocal!!,
|
|
372
|
+
style = RegularVideoRendererStyle().copy(isShowingConnectionQualityIndicator = false),
|
|
373
|
+
actionsContent = {_, _, _ -> {}},
|
|
374
|
+
)
|
|
375
|
+
}
|
|
376
|
+
)
|
|
377
|
+
}
|
|
322
378
|
)
|
|
323
379
|
}
|
|
324
380
|
}
|
|
@@ -921,7 +977,7 @@ public class StreamCallPlugin : Plugin() {
|
|
|
921
977
|
}
|
|
922
978
|
}
|
|
923
979
|
|
|
924
|
-
@OptIn(DelicateCoroutinesApi::class)
|
|
980
|
+
@OptIn(DelicateCoroutinesApi::class, InternalStreamVideoApi::class)
|
|
925
981
|
internal fun internalAcceptCall(call: Call) {
|
|
926
982
|
android.util.Log.d("StreamCallPlugin", "internalAcceptCall: Entered for call: ${call.id}")
|
|
927
983
|
kotlinx.coroutines.GlobalScope.launch {
|
|
@@ -981,11 +1037,55 @@ public class StreamCallPlugin : Plugin() {
|
|
|
981
1037
|
VideoTheme {
|
|
982
1038
|
if (call != null) {
|
|
983
1039
|
android.util.Log.d("StreamCallPlugin", "internalAcceptCall: Setting CallContent with active call ${call.id}")
|
|
1040
|
+
|
|
1041
|
+
val participants by call.state.participants.collectAsStateWithLifecycle()
|
|
1042
|
+
val sortedParticipants by call.state.sortedParticipants.collectAsStateWithLifecycle(emptyList())
|
|
1043
|
+
val callParticipants by remember(participants) {
|
|
1044
|
+
derivedStateOf {
|
|
1045
|
+
if (sortedParticipants.size > 6) {
|
|
1046
|
+
sortedParticipants
|
|
1047
|
+
} else {
|
|
1048
|
+
participants
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
val currentLocal by call.state.me.collectAsStateWithLifecycle()
|
|
1054
|
+
|
|
984
1055
|
CallContent(
|
|
985
1056
|
call = call,
|
|
986
1057
|
onBackPressed = { /* ... */ },
|
|
987
1058
|
controlsContent = { /* ... */ },
|
|
988
|
-
appBarContent = { /* ... */ }
|
|
1059
|
+
appBarContent = { /* ... */ },
|
|
1060
|
+
videoRenderer = { videoModifier, videoCall, videoParticipant, videoStyle ->
|
|
1061
|
+
ParticipantVideo(
|
|
1062
|
+
modifier = videoModifier,
|
|
1063
|
+
call = videoCall,
|
|
1064
|
+
participant = videoParticipant,
|
|
1065
|
+
style = videoStyle,
|
|
1066
|
+
actionsContent = {_, _, _ -> {}},
|
|
1067
|
+
scalingType = VideoScalingType.SCALE_ASPECT_FIT
|
|
1068
|
+
)
|
|
1069
|
+
},
|
|
1070
|
+
floatingVideoRenderer = { call, parentSize ->
|
|
1071
|
+
FloatingParticipantVideo(
|
|
1072
|
+
call = call,
|
|
1073
|
+
participant = currentLocal!!,
|
|
1074
|
+
style = RegularVideoRendererStyle().copy(isShowingConnectionQualityIndicator = false),
|
|
1075
|
+
parentBounds = parentSize,
|
|
1076
|
+
videoRenderer = { _ ->
|
|
1077
|
+
ParticipantVideo(
|
|
1078
|
+
modifier = Modifier
|
|
1079
|
+
.fillMaxSize()
|
|
1080
|
+
.clip(VideoTheme.shapes.dialog),
|
|
1081
|
+
call = call,
|
|
1082
|
+
participant = currentLocal!!,
|
|
1083
|
+
style = RegularVideoRendererStyle().copy(isShowingConnectionQualityIndicator = false),
|
|
1084
|
+
actionsContent = {_, _, _ -> {}},
|
|
1085
|
+
)
|
|
1086
|
+
}
|
|
1087
|
+
)
|
|
1088
|
+
}
|
|
989
1089
|
)
|
|
990
1090
|
} else {
|
|
991
1091
|
android.util.Log.w("StreamCallPlugin", "internalAcceptCall: Active call is null, cannot set CallContent for call ${call.id}")
|
|
@@ -1014,11 +1114,55 @@ public class StreamCallPlugin : Plugin() {
|
|
|
1014
1114
|
overlayView?.setContent {
|
|
1015
1115
|
VideoTheme {
|
|
1016
1116
|
android.util.Log.d("StreamCallPlugin", "internalAcceptCall: Force refreshing CallContent with active call ${activeCall.id}")
|
|
1117
|
+
|
|
1118
|
+
val participants by activeCall.state.participants.collectAsStateWithLifecycle()
|
|
1119
|
+
val sortedParticipants by activeCall.state.sortedParticipants.collectAsStateWithLifecycle(emptyList())
|
|
1120
|
+
val callParticipants by remember(participants) {
|
|
1121
|
+
derivedStateOf {
|
|
1122
|
+
if (sortedParticipants.size > 6) {
|
|
1123
|
+
sortedParticipants
|
|
1124
|
+
} else {
|
|
1125
|
+
participants
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
val currentLocal by activeCall.state.me.collectAsStateWithLifecycle()
|
|
1131
|
+
|
|
1017
1132
|
CallContent(
|
|
1018
1133
|
call = activeCall,
|
|
1019
1134
|
onBackPressed = { /* ... */ },
|
|
1020
1135
|
controlsContent = { /* ... */ },
|
|
1021
|
-
appBarContent = { /* ... */ }
|
|
1136
|
+
appBarContent = { /* ... */ },
|
|
1137
|
+
videoRenderer = { videoModifier, videoCall, videoParticipant, videoStyle ->
|
|
1138
|
+
ParticipantVideo(
|
|
1139
|
+
modifier = videoModifier,
|
|
1140
|
+
call = videoCall,
|
|
1141
|
+
participant = videoParticipant,
|
|
1142
|
+
style = videoStyle,
|
|
1143
|
+
actionsContent = {_, _, _ -> {}},
|
|
1144
|
+
scalingType = VideoScalingType.SCALE_ASPECT_FIT
|
|
1145
|
+
)
|
|
1146
|
+
},
|
|
1147
|
+
floatingVideoRenderer = { call, parentSize ->
|
|
1148
|
+
FloatingParticipantVideo(
|
|
1149
|
+
call = call,
|
|
1150
|
+
participant = currentLocal!!,
|
|
1151
|
+
style = RegularVideoRendererStyle().copy(isShowingConnectionQualityIndicator = false),
|
|
1152
|
+
parentBounds = parentSize,
|
|
1153
|
+
videoRenderer = { _ ->
|
|
1154
|
+
ParticipantVideo(
|
|
1155
|
+
modifier = Modifier
|
|
1156
|
+
.fillMaxSize()
|
|
1157
|
+
.clip(VideoTheme.shapes.dialog),
|
|
1158
|
+
call = call,
|
|
1159
|
+
participant = currentLocal!!,
|
|
1160
|
+
style = RegularVideoRendererStyle().copy(isShowingConnectionQualityIndicator = false),
|
|
1161
|
+
actionsContent = {_, _, _ -> {}},
|
|
1162
|
+
)
|
|
1163
|
+
}
|
|
1164
|
+
)
|
|
1165
|
+
}
|
|
1022
1166
|
)
|
|
1023
1167
|
}
|
|
1024
1168
|
}
|
|
@@ -1204,6 +1348,7 @@ public class StreamCallPlugin : Plugin() {
|
|
|
1204
1348
|
}
|
|
1205
1349
|
}
|
|
1206
1350
|
|
|
1351
|
+
@OptIn(InternalStreamVideoApi::class)
|
|
1207
1352
|
private suspend fun endCallRaw(call: Call) {
|
|
1208
1353
|
val callId = call.id
|
|
1209
1354
|
android.util.Log.d("StreamCallPlugin", "Attempting to end call $callId")
|
|
@@ -1281,11 +1426,54 @@ public class StreamCallPlugin : Plugin() {
|
|
|
1281
1426
|
|
|
1282
1427
|
overlayView?.setContent {
|
|
1283
1428
|
VideoTheme {
|
|
1429
|
+
val participants by call.state.participants.collectAsStateWithLifecycle()
|
|
1430
|
+
val sortedParticipants by call.state.sortedParticipants.collectAsStateWithLifecycle(emptyList())
|
|
1431
|
+
val callParticipants by remember(participants) {
|
|
1432
|
+
derivedStateOf {
|
|
1433
|
+
if (sortedParticipants.size > 6) {
|
|
1434
|
+
sortedParticipants
|
|
1435
|
+
} else {
|
|
1436
|
+
participants
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
val currentLocal by call.state.me.collectAsStateWithLifecycle()
|
|
1442
|
+
|
|
1284
1443
|
CallContent(
|
|
1285
1444
|
call = call,
|
|
1286
1445
|
onBackPressed = { /* Handle back press if needed */ },
|
|
1287
1446
|
controlsContent = { /* Empty to disable native controls */ },
|
|
1288
|
-
appBarContent = { /* Empty to disable app bar with stop call button */ }
|
|
1447
|
+
appBarContent = { /* Empty to disable app bar with stop call button */ },
|
|
1448
|
+
videoRenderer = { videoModifier, videoCall, videoParticipant, videoStyle ->
|
|
1449
|
+
ParticipantVideo(
|
|
1450
|
+
modifier = videoModifier,
|
|
1451
|
+
call = videoCall,
|
|
1452
|
+
participant = videoParticipant,
|
|
1453
|
+
style = videoStyle,
|
|
1454
|
+
actionsContent = {_, _, _ -> {}},
|
|
1455
|
+
scalingType = VideoScalingType.SCALE_ASPECT_FIT
|
|
1456
|
+
)
|
|
1457
|
+
},
|
|
1458
|
+
floatingVideoRenderer = { call, parentSize ->
|
|
1459
|
+
FloatingParticipantVideo(
|
|
1460
|
+
call = call,
|
|
1461
|
+
participant = currentLocal!!,
|
|
1462
|
+
style = RegularVideoRendererStyle().copy(isShowingConnectionQualityIndicator = false),
|
|
1463
|
+
parentBounds = parentSize,
|
|
1464
|
+
videoRenderer = { _ ->
|
|
1465
|
+
ParticipantVideo(
|
|
1466
|
+
modifier = Modifier
|
|
1467
|
+
.fillMaxSize()
|
|
1468
|
+
.clip(VideoTheme.shapes.dialog),
|
|
1469
|
+
call = call,
|
|
1470
|
+
participant = currentLocal!!,
|
|
1471
|
+
style = RegularVideoRendererStyle().copy(isShowingConnectionQualityIndicator = false),
|
|
1472
|
+
actionsContent = {_, _, _ -> {}},
|
|
1473
|
+
)
|
|
1474
|
+
}
|
|
1475
|
+
)
|
|
1476
|
+
}
|
|
1289
1477
|
)
|
|
1290
1478
|
}
|
|
1291
1479
|
}
|
|
@@ -1389,7 +1577,7 @@ public class StreamCallPlugin : Plugin() {
|
|
|
1389
1577
|
}
|
|
1390
1578
|
}
|
|
1391
1579
|
|
|
1392
|
-
@OptIn(DelicateCoroutinesApi::class)
|
|
1580
|
+
@OptIn(DelicateCoroutinesApi::class, InternalStreamVideoApi::class)
|
|
1393
1581
|
@PluginMethod
|
|
1394
1582
|
fun call(call: PluginCall) {
|
|
1395
1583
|
val userIds = call.getArray("userIds")?.toList<String>()
|
|
@@ -1461,11 +1649,54 @@ public class StreamCallPlugin : Plugin() {
|
|
|
1461
1649
|
overlayView?.setContent {
|
|
1462
1650
|
VideoTheme {
|
|
1463
1651
|
if (streamCall != null) {
|
|
1652
|
+
|
|
1653
|
+
val participants by streamCall.state.participants.collectAsStateWithLifecycle()
|
|
1654
|
+
val sortedParticipants by streamCall.state.sortedParticipants.collectAsStateWithLifecycle(emptyList())
|
|
1655
|
+
val callParticipants by remember(participants) {
|
|
1656
|
+
derivedStateOf {
|
|
1657
|
+
if (sortedParticipants.size > 6) {
|
|
1658
|
+
sortedParticipants
|
|
1659
|
+
} else {
|
|
1660
|
+
participants
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
val currentLocal by streamCall.state.me.collectAsStateWithLifecycle()
|
|
1666
|
+
|
|
1464
1667
|
CallContent(
|
|
1465
1668
|
call = streamCall,
|
|
1466
1669
|
onBackPressed = { /* Handle back press if needed */ },
|
|
1467
1670
|
controlsContent = { /* Empty to disable native controls */ },
|
|
1468
|
-
appBarContent = { /* Empty to disable app bar with stop call button */ }
|
|
1671
|
+
appBarContent = { /* Empty to disable app bar with stop call button */ },
|
|
1672
|
+
videoRenderer = { videoModifier, videoCall, videoParticipant, videoStyle ->
|
|
1673
|
+
ParticipantVideo(
|
|
1674
|
+
modifier = videoModifier,
|
|
1675
|
+
call = videoCall,
|
|
1676
|
+
participant = videoParticipant,
|
|
1677
|
+
style = videoStyle,
|
|
1678
|
+
actionsContent = {_, _, _ -> {}},
|
|
1679
|
+
scalingType = VideoScalingType.SCALE_ASPECT_FIT
|
|
1680
|
+
)
|
|
1681
|
+
},
|
|
1682
|
+
floatingVideoRenderer = { call, parentSize ->
|
|
1683
|
+
FloatingParticipantVideo(
|
|
1684
|
+
call = call,
|
|
1685
|
+
participant = currentLocal!!,
|
|
1686
|
+
style = RegularVideoRendererStyle().copy(isShowingConnectionQualityIndicator = false),
|
|
1687
|
+
parentBounds = parentSize,
|
|
1688
|
+
videoRenderer = { _ ->
|
|
1689
|
+
ParticipantVideo(
|
|
1690
|
+
modifier = Modifier
|
|
1691
|
+
.fillMaxSize()
|
|
1692
|
+
.clip(VideoTheme.shapes.dialog),
|
|
1693
|
+
call = call,
|
|
1694
|
+
participant = currentLocal!!,
|
|
1695
|
+
style = RegularVideoRendererStyle().copy(isShowingConnectionQualityIndicator = false),
|
|
1696
|
+
)
|
|
1697
|
+
}
|
|
1698
|
+
)
|
|
1699
|
+
}
|
|
1469
1700
|
)
|
|
1470
1701
|
}
|
|
1471
1702
|
}
|
package/package.json
CHANGED