@tellescope/video-chat 1.3.28 → 1.3.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/video-chat",
3
- "version": "1.3.28",
3
+ "version": "1.3.30",
4
4
  "description": "",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -35,7 +35,7 @@
35
35
  "@mui/icons-material": "^5.0.1",
36
36
  "@mui/material": "^5.0.2",
37
37
  "@tellescope/constants": "^1.3.24",
38
- "@tellescope/react-components": "^1.3.27",
38
+ "@tellescope/react-components": "^1.3.30",
39
39
  "@tellescope/sdk": "^1.3.25",
40
40
  "@tellescope/types-client": "^1.3.24",
41
41
  "@tellescope/types-models": "^1.3.24",
@@ -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": "9a370854c801dd857e45a7662707bce4916a39e3",
58
+ "gitHead": "99f91ad546b30d6debc5ea5fa3360c959e094246",
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  }
package/src/controls.tsx CHANGED
@@ -73,7 +73,6 @@ export const LeaveMeeting = ({ onLeave, size=DEFAULT_BUTTON_SIZE } : LeaveMeetin
73
73
  interface ControlbarProps {
74
74
  spacing?: number,
75
75
  size?: number,
76
-
77
76
  }
78
77
  export const ControlBar = ({ onLeave, style, spacing=15, size } : ControlbarProps & LeaveMeetingProps & Styled) => {
79
78
  const { isHost } = React.useContext(CurrentCallContext)
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import React, { useCallback, useContext, useEffect, useState } from "react"
10
- import { View, StyleSheet } from "react-native"
10
+ import { StyleSheet } from "react-native"
11
11
  import {
12
12
  AttendeeInfo,
13
13
  MeetingInfo,
@@ -20,10 +20,9 @@ import {
20
20
  useSession,
21
21
  Flex,
22
22
  useCalendarEvents,
23
+ useMeetings,
23
24
  } from "@tellescope/react-components"
24
25
  import {
25
- Button,
26
- Typography,
27
26
  convert_CSS_to_RNStyles, // requires mui.native
28
27
  } from "@tellescope/react-components/lib/esm/mui.native"
29
28
 
@@ -43,8 +42,6 @@ import {
43
42
  NativeFunction,
44
43
  ControlBar,
45
44
  } from "./index.native"
46
- import { borderColor, borderRadius } from "@mui/system"
47
- import { ConstructionOutlined } from "@mui/icons-material"
48
45
  // import RNSwitchAudioOutput from 'react-native-switch-audio-output';
49
46
 
50
47
  interface TileState {
@@ -147,6 +144,9 @@ export const WithVideo = ({ children } : VideoProps) => {
147
144
  setVideoIsEnabled(v => tileState.isLocal ? false : v)
148
145
  });
149
146
 
147
+ // clean up any old meetings when the context is loaded
148
+ NativeFunction.stopMeeting()
149
+
150
150
  return () => {
151
151
  startSubscription.remove();
152
152
  endSubscription.remove();
@@ -202,6 +202,8 @@ export const useStartVideoCall = (): StartVideoCallReturnType => {
202
202
  const session = useSession()
203
203
  const { meeting, setMeeting, setIsHost, videoIsEnabled, toggleVideo } = React.useContext(CurrentCallContext)
204
204
 
205
+ const [, { updateLocalElement: updateLocalMeeting }] = useMeetings({ dontFetch: true })
206
+
205
207
  const [starting, setStarting] = useState(false)
206
208
  const [ending, setEnding] = useState(false)
207
209
 
@@ -234,10 +236,15 @@ export const useStartVideoCall = (): StartVideoCallReturnType => {
234
236
 
235
237
  try {
236
238
  await session.api.meetings.end_meeting({ id: meeting.ExternalMeetingId })
239
+
240
+ updateLocalMeeting(meeting.ExternalMeetingId, {
241
+ status: 'ended',
242
+ // @ts-ignore
243
+ endedAt: new Date().toString(),
244
+ })
237
245
  } catch(err) { console.error(err) }
238
246
 
239
- setEnding(false)
240
- setMeeting(undefined)
247
+ NativeFunction.stopMeeting()
241
248
  }
242
249
 
243
250
  return {
@@ -306,59 +313,13 @@ export const useJoinVideoCall = (): JoinVideoCallReturnType => {
306
313
  setIsHost(isHost)
307
314
  }
308
315
 
309
- const leaveMeeting = () => setMeeting(undefined)
316
+ const leaveMeeting = () => {
317
+ NativeFunction.stopMeeting()
318
+ // setMeeting(undefined)
319
+ }
310
320
 
311
321
  return { meeting, videoIsEnabled, toggleVideo, joinMeeting, leaveMeeting }
312
322
  }
313
- export const VideoTileGrid = () => {
314
- const {
315
- // attendees,
316
- videoTiles,
317
- toggleVideo,
318
- } = useContext(CurrentCallContext)
319
-
320
- return (
321
- <Flex column justifyContent="space-between" alignItems="center">
322
- <Flex style={styles.videoContainer}>
323
- {
324
- videoTiles.length > 0 ? videoTiles.map(tileId =>
325
- <RNVideoRenderView style={styles.video} key={tileId} tileId={tileId} />
326
- ) : <Typography style={styles.subtitle}>No one is sharing video at this moment</Typography>
327
- }
328
- </Flex>
329
-
330
- {/*
331
- {
332
- !!shareScreenId &&
333
- <React.Fragment>
334
- <Typography style={styles.title}>Screen Share</Typography>
335
- <View style={styles.videoContainer}>
336
- <RNVideoRenderView style={styles.screenShare} key={shareScreenId} tileId={shareScreenId} />
337
- </View>
338
- </React.Fragment>
339
- }
340
- */}
341
-
342
- <Flex justifyContent="space-between" style={{ height: '5%' }}>
343
- {/* <MuteButton muted={currentMuted} onPress={() => NativeFunction.setMute(!currentMuted) }/> */}
344
- {/* <CameraButton disabled={selfVideoEnabled} onPress={() => NativeFunction.setCameraOn(!videoIsEnabled)}/> */}
345
- <Button onPress={toggleVideo}>
346
- Toggle Video
347
- </Button>
348
- {/* <HangOffButton onPress={() => NativeFunction.stopMeeting()} /> */}
349
- <Button onPress={() => NativeFunction.stopMeeting()}> Leave Meeting </Button>
350
- </Flex>
351
-
352
- {/* <FlatList
353
- style={styles.attendeeList}
354
- data={attendees}
355
- renderItem={({ item }) => <AttendeeItem attendeeName={attendeeNameMap[item] ? attendeeNameMap[item] : item} muted={this.state.mutedAttendee.includes(item)}/>}
356
- keyExtractor={(item) => item}
357
- /> */}
358
-
359
- </Flex>
360
- );
361
- }
362
323
 
363
324
  const styles = StyleSheet.create({
364
325
  title: {
@@ -483,9 +444,7 @@ export const VideoCallNative: React.JSXElementConstructor<VideoCallNativeProps>
483
444
 
484
445
  </Flex>
485
446
 
486
- <ControlBar {...props}
487
- style={{ position: 'absolute', bottom: 20, width: '100%' }}
488
- />
447
+ <ControlBar {...props} size={50} spacing={20} style={{ position: 'absolute', bottom: 20, width: '100%' }} />
489
448
  </Flex>
490
449
  )
491
450
  }