@tellescope/video-chat 1.3.27 → 1.3.28
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.
- package/lib/cjs/video.native.d.ts.map +1 -1
- package/lib/cjs/video.native.js +46 -18
- package/lib/cjs/video.native.js.map +1 -1
- package/lib/esm/video.native.d.ts.map +1 -1
- package/lib/esm/video.native.js +46 -18
- package/lib/esm/video.native.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/video.native.tsx +25 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/video-chat",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.28",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
56
56
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "9a370854c801dd857e45a7662707bce4916a39e3",
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
}
|
package/src/video.native.tsx
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
ControlBar,
|
|
45
45
|
} from "./index.native"
|
|
46
46
|
import { borderColor, borderRadius } from "@mui/system"
|
|
47
|
+
import { ConstructionOutlined } from "@mui/icons-material"
|
|
47
48
|
// import RNSwitchAudioOutput from 'react-native-switch-audio-output';
|
|
48
49
|
|
|
49
50
|
interface TileState {
|
|
@@ -65,6 +66,17 @@ export const WithVideo = ({ children } : VideoProps) => {
|
|
|
65
66
|
const [screenShareTile, setScreenShareTile] = useState(null as number | null)
|
|
66
67
|
const [attendees, setAttendees] = useState ([] as AttendeeDisplayInfo[])
|
|
67
68
|
|
|
69
|
+
const resetState = () => {
|
|
70
|
+
setMeeting(undefined)
|
|
71
|
+
setIsHost(false)
|
|
72
|
+
setMuted(false)
|
|
73
|
+
setVideoIsEnabled(false)
|
|
74
|
+
setVideoTiles([])
|
|
75
|
+
setLocalTileId(null)
|
|
76
|
+
setScreenShareTile(null)
|
|
77
|
+
setAttendees([])
|
|
78
|
+
}
|
|
79
|
+
|
|
68
80
|
const toggleVideo = async () => {
|
|
69
81
|
NativeFunction.setCameraOn(!videoIsEnabled)
|
|
70
82
|
if (videoIsEnabled) {
|
|
@@ -86,8 +98,7 @@ export const WithVideo = ({ children } : VideoProps) => {
|
|
|
86
98
|
|
|
87
99
|
// called when user clicks Leave Meeting or meeting is ended by host
|
|
88
100
|
const endSubscription = emitter.addListener(MobileSDKEvent.OnMeetingEnd, a => {
|
|
89
|
-
|
|
90
|
-
setIsLoading(false)
|
|
101
|
+
resetState()
|
|
91
102
|
});
|
|
92
103
|
|
|
93
104
|
const joinSubscription = emitter.addListener(MobileSDKEvent.OnAttendeesJoin, (added: { attendeeId: string, externalUserId: string }) => {
|
|
@@ -104,7 +115,7 @@ export const WithVideo = ({ children } : VideoProps) => {
|
|
|
104
115
|
});
|
|
105
116
|
|
|
106
117
|
const errorSubscription = emitter.addListener(MobileSDKEvent.OnError, (message) => {
|
|
107
|
-
console.error("SDK Error", message);
|
|
118
|
+
console.error("SDK Error in errorSubscription", message);
|
|
108
119
|
});
|
|
109
120
|
|
|
110
121
|
const muteSubscription = emitter.addListener(MobileSDKEvent.OnAttendeesMute, attendeeId => {
|
|
@@ -198,7 +209,7 @@ export const useStartVideoCall = (): StartVideoCallReturnType => {
|
|
|
198
209
|
setStarting(true)
|
|
199
210
|
try {
|
|
200
211
|
const { id, meeting, host } = await session.api.meetings.start_meeting({ attendees: initialAttendees })
|
|
201
|
-
NativeFunction.startMeeting(meeting.Meeting, host.info)
|
|
212
|
+
await NativeFunction.startMeeting(meeting.Meeting, host.info)
|
|
202
213
|
|
|
203
214
|
setMeeting(meeting.Meeting)
|
|
204
215
|
setIsHost(true)
|
|
@@ -255,7 +266,7 @@ export const useStartAndJoinMeetingForCalendarEvent = (calendarEventId: string)
|
|
|
255
266
|
|
|
256
267
|
updateLocalEvent(calendarEventId, { meetingId: id } )
|
|
257
268
|
|
|
258
|
-
NativeFunction.startMeeting(meeting.Meeting, host.info)
|
|
269
|
+
await NativeFunction.startMeeting(meeting.Meeting, host.info)
|
|
259
270
|
|
|
260
271
|
setMeeting(meeting.Meeting)
|
|
261
272
|
setIsHost(true)
|
|
@@ -271,6 +282,7 @@ export const useJoinVideoCall = (): JoinVideoCallReturnType => {
|
|
|
271
282
|
const { meeting, setIsHost, setMeeting, videoIsEnabled, toggleVideo } = React.useContext(CurrentCallContext)
|
|
272
283
|
|
|
273
284
|
const joinMeeting = async (meetingInfo: string | { Meeting: MeetingInfo }, attendeeInfo?: { Attendee: AttendeeInfo }) => {
|
|
285
|
+
let isHost = false
|
|
274
286
|
if (typeof meetingInfo == 'string') {
|
|
275
287
|
const meetings = await session.api.meetings.my_meetings()
|
|
276
288
|
const meeting = meetings.find(m => m.id === meetingInfo)
|
|
@@ -278,15 +290,20 @@ export const useJoinVideoCall = (): JoinVideoCallReturnType => {
|
|
|
278
290
|
attendeeInfo = { Attendee: meeting?.attendees.find?.(a => a.id === session.userInfo.id)?.info as AttendeeInfo}
|
|
279
291
|
|
|
280
292
|
if (attendeeInfo.Attendee.ExternalUserId === meeting?.creator) {
|
|
281
|
-
|
|
293
|
+
isHost = true
|
|
282
294
|
}
|
|
283
295
|
}
|
|
284
296
|
|
|
285
297
|
if (!meetingInfo || typeof meetingInfo === 'string' || !attendeeInfo) return
|
|
286
298
|
|
|
287
|
-
|
|
299
|
+
try {
|
|
300
|
+
await NativeFunction.startMeeting(meetingInfo.Meeting ?? meetingInfo, attendeeInfo.Attendee ?? attendeeInfo)
|
|
301
|
+
} catch(err) {
|
|
302
|
+
await NativeFunction.startMeeting(meetingInfo.Meeting ?? meetingInfo, attendeeInfo.Attendee ?? attendeeInfo)
|
|
303
|
+
}
|
|
288
304
|
|
|
289
|
-
setMeeting(meetingInfo.Meeting)
|
|
305
|
+
setMeeting(meetingInfo.Meeting ?? meetingInfo)
|
|
306
|
+
setIsHost(isHost)
|
|
290
307
|
}
|
|
291
308
|
|
|
292
309
|
const leaveMeeting = () => setMeeting(undefined)
|