@@ -32,6 +32,7 @@ import { Container, WidgetLayoutStore } from "../../stores/widgets/WidgetLayoutS
32
32
import { useRoomState } from "../useRoomState" ;
33
33
import { _t } from "../../languageHandler" ;
34
34
import { isManagedHybridWidget } from "../../widgets/ManagedHybrid" ;
35
+ import { IApp } from "../../stores/WidgetStore" ;
35
36
36
37
export type PlatformCallType = "element_call" | "jitsi_or_element_call" | "legacy_or_jitsi" ;
37
38
@@ -91,12 +92,14 @@ export const useRoomCall = (
91
92
if ( mayCreateElementCalls && hasJitsiWidget ) {
92
93
return "jitsi_or_element_call" ;
93
94
}
94
- if ( useElementCallExclusively || mayCreateElementCalls ) {
95
- // Looks like for Audio this was previously legacy_or_jitsi
95
+ if ( useElementCallExclusively ) {
96
96
return "element_call" ;
97
97
}
98
- if ( mayEditWidgets ) {
99
- return "jitsi_or_element_call" ;
98
+ if ( memberCount <= 2 ) {
99
+ return "legacy_or_jitsi" ;
100
+ }
101
+ if ( mayCreateElementCalls ) {
102
+ return "element_call" ;
100
103
}
101
104
}
102
105
return "legacy_or_jitsi" ;
@@ -106,9 +109,17 @@ export const useRoomCall = (
106
109
mayCreateElementCalls ,
107
110
hasJitsiWidget ,
108
111
useElementCallExclusively ,
109
- mayEditWidgets ,
112
+ memberCount ,
110
113
] ) ;
111
- const widget = callType === "element_call" ? groupCall ?. widget : jitsiWidget ?? managedHybridWidget ;
114
+
115
+ let widget : IApp | undefined ;
116
+ if ( callType === "legacy_or_jitsi" ) {
117
+ widget = jitsiWidget ?? managedHybridWidget ;
118
+ } else if ( callType === "element_call" ) {
119
+ widget = groupCall ?. widget ;
120
+ } else {
121
+ widget = groupCall ?. widget ?? jitsiWidget ;
122
+ }
112
123
113
124
const [ canPinWidget , setCanPinWidget ] = useState ( false ) ;
114
125
const [ widgetPinned , setWidgetPinned ] = useState ( false ) ;
@@ -180,7 +191,7 @@ export const useRoomCall = (
180
191
switch ( state ) {
181
192
case State . NoPermission :
182
193
voiceCallDisabledReason = _t ( "You do not have permission to start voice calls" ) ;
183
- videoCallDisabledReason = _t ( "You do not have permission to start voice calls" ) ;
194
+ videoCallDisabledReason = _t ( "You do not have permission to start video calls" ) ;
184
195
break ;
185
196
case State . Ongoing :
186
197
voiceCallDisabledReason = _t ( "Ongoing call" ) ;
0 commit comments