@100mslive/roomkit-react 0.3.14-alpha.6 → 0.3.14-alpha.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -4951,7 +4951,7 @@
4951
4951
  "format": "cjs"
4952
4952
  },
4953
4953
  "../hms-video-store/dist/index.js": {
4954
- "bytes": 355009,
4954
+ "bytes": 356187,
4955
4955
  "imports": [
4956
4956
  {
4957
4957
  "path": "../../node_modules/reselect/es/index.js",
@@ -10974,7 +10974,7 @@
10974
10974
  ],
10975
10975
  "format": "esm"
10976
10976
  },
10977
- "../../../../../../../tmp/tmp-2787-KwE6v4ehqlUy/190359341ca2/tldraw.css": {
10977
+ "../../../../../../../tmp/tmp-2968-7h0gdY75JTYT/1903acfa6923/tldraw.css": {
10978
10978
  "bytes": 80111,
10979
10979
  "imports": [
10980
10980
  {
@@ -11024,7 +11024,7 @@
11024
11024
  }
11025
11025
  ]
11026
11026
  },
11027
- "../../../../../../../tmp/tmp-2787-KwE6v4ehqlUy/190359341680/index.css": {
11027
+ "../../../../../../../tmp/tmp-2968-7h0gdY75JTYT/1903acfa62a1/index.css": {
11028
11028
  "bytes": 597,
11029
11029
  "imports": [
11030
11030
  {
@@ -11033,7 +11033,7 @@
11033
11033
  "external": true
11034
11034
  },
11035
11035
  {
11036
- "path": "../../../../../../../tmp/tmp-2787-KwE6v4ehqlUy/190359341ca2/tldraw.css",
11036
+ "path": "../../../../../../../tmp/tmp-2968-7h0gdY75JTYT/1903acfa6923/tldraw.css",
11037
11037
  "kind": "import-rule",
11038
11038
  "original": "@tldraw/tldraw/tldraw.css"
11039
11039
  }
@@ -11108,7 +11108,7 @@
11108
11108
  "original": "../../common/constants"
11109
11109
  },
11110
11110
  {
11111
- "path": "../../../../../../../tmp/tmp-2787-KwE6v4ehqlUy/190359341680/index.css",
11111
+ "path": "../../../../../../../tmp/tmp-2968-7h0gdY75JTYT/1903acfa62a1/index.css",
11112
11112
  "kind": "import-statement",
11113
11113
  "original": "@100mslive/hms-whiteboard/index.css"
11114
11114
  },
@@ -13195,7 +13195,7 @@
13195
13195
  "imports": []
13196
13196
  },
13197
13197
  "src/Prebuilt/components/Notifications/PermissionErrorModal.tsx": {
13198
- "bytes": 4888,
13198
+ "bytes": 4913,
13199
13199
  "imports": [
13200
13200
  {
13201
13201
  "path": "react",
@@ -13406,7 +13406,7 @@
13406
13406
  "format": "esm"
13407
13407
  },
13408
13408
  "src/Prebuilt/components/Notifications/Notifications.tsx": {
13409
- "bytes": 8034,
13409
+ "bytes": 8058,
13410
13410
  "imports": [
13411
13411
  {
13412
13412
  "path": "react",
@@ -14409,7 +14409,7 @@
14409
14409
  "format": "esm"
14410
14410
  },
14411
14411
  "src/Diagnostics/AudioTest.tsx": {
14412
- "bytes": 5194,
14412
+ "bytes": 5792,
14413
14413
  "imports": [
14414
14414
  {
14415
14415
  "path": "react",
@@ -14426,6 +14426,11 @@
14426
14426
  "kind": "import-statement",
14427
14427
  "external": true
14428
14428
  },
14429
+ {
14430
+ "path": "src/Prebuilt/components/Notifications/PermissionErrorModal.tsx",
14431
+ "kind": "import-statement",
14432
+ "original": "../Prebuilt/components/Notifications/PermissionErrorModal"
14433
+ },
14429
14434
  {
14430
14435
  "path": "src/Diagnostics/components.tsx",
14431
14436
  "kind": "import-statement",
@@ -14480,7 +14485,7 @@
14480
14485
  "format": "esm"
14481
14486
  },
14482
14487
  "src/Diagnostics/BrowserTest.tsx": {
14483
- "bytes": 4051,
14488
+ "bytes": 4184,
14484
14489
  "imports": [
14485
14490
  {
14486
14491
  "path": "react",
@@ -14582,7 +14587,7 @@
14582
14587
  "format": "esm"
14583
14588
  },
14584
14589
  "src/Diagnostics/VideoTest.tsx": {
14585
- "bytes": 2346,
14590
+ "bytes": 2521,
14586
14591
  "imports": [
14587
14592
  {
14588
14593
  "path": "react",
@@ -14599,6 +14604,11 @@
14599
14604
  "kind": "import-statement",
14600
14605
  "external": true
14601
14606
  },
14607
+ {
14608
+ "path": "src/Prebuilt/components/Notifications/PermissionErrorModal.tsx",
14609
+ "kind": "import-statement",
14610
+ "original": "../Prebuilt/components/Notifications/PermissionErrorModal"
14611
+ },
14602
14612
  {
14603
14613
  "path": "src/Diagnostics/components.tsx",
14604
14614
  "kind": "import-statement",
@@ -14648,7 +14658,7 @@
14648
14658
  "format": "esm"
14649
14659
  },
14650
14660
  "src/Diagnostics/Diagnostics.tsx": {
14651
- "bytes": 4574,
14661
+ "bytes": 4666,
14652
14662
  "imports": [
14653
14663
  {
14654
14664
  "path": "react",
@@ -14961,7 +14971,7 @@
14961
14971
  "dist/index.js": {
14962
14972
  "imports": [
14963
14973
  {
14964
- "path": "dist/chunk-MIJLZRDK.js",
14974
+ "path": "dist/chunk-EODBFJ5Y.js",
14965
14975
  "kind": "import-statement"
14966
14976
  }
14967
14977
  ],
@@ -15037,16 +15047,16 @@
15037
15047
  "inputs": {},
15038
15048
  "bytes": 1882
15039
15049
  },
15040
- "dist/HLSView-3BTMB5NS.js.map": {
15050
+ "dist/HLSView-C7QKK3HT.js.map": {
15041
15051
  "imports": [],
15042
15052
  "exports": [],
15043
15053
  "inputs": {},
15044
15054
  "bytes": 100275
15045
15055
  },
15046
- "dist/HLSView-3BTMB5NS.js": {
15056
+ "dist/HLSView-C7QKK3HT.js": {
15047
15057
  "imports": [
15048
15058
  {
15049
- "path": "dist/chunk-MIJLZRDK.js",
15059
+ "path": "dist/chunk-EODBFJ5Y.js",
15050
15060
  "kind": "import-statement"
15051
15061
  },
15052
15062
  {
@@ -15224,7 +15234,7 @@
15224
15234
  "default"
15225
15235
  ],
15226
15236
  "entryPoint": "src/Prebuilt/layouts/HLSView.jsx",
15227
- "cssBundle": "dist/HLSView-E4CL2XZ5.css",
15237
+ "cssBundle": "dist/HLSView-UMOI3RZE.css",
15228
15238
  "inputs": {
15229
15239
  "src/Prebuilt/layouts/HLSView.jsx": {
15230
15240
  "bytesInOutput": 27671
@@ -15283,13 +15293,13 @@
15283
15293
  },
15284
15294
  "bytes": 61702
15285
15295
  },
15286
- "dist/chunk-MIJLZRDK.js.map": {
15296
+ "dist/chunk-EODBFJ5Y.js.map": {
15287
15297
  "imports": [],
15288
15298
  "exports": [],
15289
15299
  "inputs": {},
15290
- "bytes": 3890716
15300
+ "bytes": 3895547
15291
15301
  },
15292
- "dist/chunk-MIJLZRDK.js": {
15302
+ "dist/chunk-EODBFJ5Y.js": {
15293
15303
  "imports": [
15294
15304
  {
15295
15305
  "path": "react",
@@ -17772,7 +17782,7 @@
17772
17782
  "external": true
17773
17783
  },
17774
17784
  {
17775
- "path": "dist/HLSView-3BTMB5NS.js",
17785
+ "path": "dist/HLSView-C7QKK3HT.js",
17776
17786
  "kind": "dynamic-import"
17777
17787
  },
17778
17788
  {
@@ -18356,7 +18366,7 @@
18356
18366
  ],
18357
18367
  "inputs": {
18358
18368
  "<define:process.env>": {
18359
- "bytesInOutput": 17868
18369
+ "bytesInOutput": 17887
18360
18370
  },
18361
18371
  "../../node_modules/lodash/lodash.js": {
18362
18372
  "bytesInOutput": 224414
@@ -18839,7 +18849,7 @@
18839
18849
  "bytesInOutput": 9484
18840
18850
  },
18841
18851
  "../hms-video-store/dist/index.js": {
18842
- "bytesInOutput": 457464
18852
+ "bytesInOutput": 459085
18843
18853
  },
18844
18854
  "../../node_modules/reselect/es/index.js": {
18845
18855
  "bytesInOutput": 2550
@@ -19237,7 +19247,7 @@
19237
19247
  "src/Prebuilt/components/VideoLayouts/WhiteboardLayout.tsx": {
19238
19248
  "bytesInOutput": 2797
19239
19249
  },
19240
- "../../../../../../../tmp/tmp-2787-KwE6v4ehqlUy/190359341680/index.css": {
19250
+ "../../../../../../../tmp/tmp-2968-7h0gdY75JTYT/1903acfa62a1/index.css": {
19241
19251
  "bytesInOutput": 0
19242
19252
  },
19243
19253
  "src/Prebuilt/common/PeersSorter.ts": {
@@ -19298,7 +19308,7 @@
19298
19308
  "bytesInOutput": 27
19299
19309
  },
19300
19310
  "src/Prebuilt/components/Notifications/Notifications.tsx": {
19301
- "bytesInOutput": 8116
19311
+ "bytesInOutput": 8128
19302
19312
  },
19303
19313
  "src/Prebuilt/components/Notifications/AutoplayBlockedModal.tsx": {
19304
19314
  "bytesInOutput": 1053
@@ -19322,7 +19332,7 @@
19322
19332
  "bytesInOutput": 1428
19323
19333
  },
19324
19334
  "src/Prebuilt/components/Notifications/PermissionErrorModal.tsx": {
19325
- "bytesInOutput": 4537
19335
+ "bytesInOutput": 4527
19326
19336
  },
19327
19337
  "src/Prebuilt/images/android-perm-1.png": {
19328
19338
  "bytesInOutput": 10443
@@ -19382,7 +19392,7 @@
19382
19392
  "bytesInOutput": 27
19383
19393
  },
19384
19394
  "src/Diagnostics/Diagnostics.tsx": {
19385
- "bytesInOutput": 4825
19395
+ "bytesInOutput": 4900
19386
19396
  },
19387
19397
  "src/Diagnostics/components.tsx": {
19388
19398
  "bytesInOutput": 2375
@@ -19391,22 +19401,22 @@
19391
19401
  "bytesInOutput": 237
19392
19402
  },
19393
19403
  "src/Diagnostics/AudioTest.tsx": {
19394
- "bytesInOutput": 5341
19404
+ "bytesInOutput": 5835
19395
19405
  },
19396
19406
  "src/Diagnostics/DeviceSelector.jsx": {
19397
19407
  "bytesInOutput": 2155
19398
19408
  },
19399
19409
  "src/Diagnostics/BrowserTest.tsx": {
19400
- "bytesInOutput": 4041
19410
+ "bytesInOutput": 4243
19401
19411
  },
19402
19412
  "src/Diagnostics/ConnectivityTest.tsx": {
19403
19413
  "bytesInOutput": 12614
19404
19414
  },
19405
19415
  "src/Diagnostics/VideoTest.tsx": {
19406
- "bytesInOutput": 2295
19416
+ "bytesInOutput": 2376
19407
19417
  }
19408
19418
  },
19409
- "bytes": 1849355
19419
+ "bytes": 1851849
19410
19420
  },
19411
19421
  "dist/index.css.map": {
19412
19422
  "imports": [],
@@ -19468,22 +19478,22 @@
19468
19478
  }
19469
19479
  ],
19470
19480
  "inputs": {
19471
- "../../../../../../../tmp/tmp-2787-KwE6v4ehqlUy/190359341ca2/tldraw.css": {
19481
+ "../../../../../../../tmp/tmp-2968-7h0gdY75JTYT/1903acfa6923/tldraw.css": {
19472
19482
  "bytesInOutput": 75223
19473
19483
  },
19474
- "../../../../../../../tmp/tmp-2787-KwE6v4ehqlUy/190359341680/index.css": {
19484
+ "../../../../../../../tmp/tmp-2968-7h0gdY75JTYT/1903acfa62a1/index.css": {
19475
19485
  "bytesInOutput": 401
19476
19486
  }
19477
19487
  },
19478
19488
  "bytes": 75901
19479
19489
  },
19480
- "dist/HLSView-E4CL2XZ5.css.map": {
19490
+ "dist/HLSView-UMOI3RZE.css.map": {
19481
19491
  "imports": [],
19482
19492
  "exports": [],
19483
19493
  "inputs": {},
19484
19494
  "bytes": 122402
19485
19495
  },
19486
- "dist/HLSView-E4CL2XZ5.css": {
19496
+ "dist/HLSView-UMOI3RZE.css": {
19487
19497
  "imports": [
19488
19498
  {
19489
19499
  "path": "https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap",
@@ -19537,10 +19547,10 @@
19537
19547
  }
19538
19548
  ],
19539
19549
  "inputs": {
19540
- "../../../../../../../tmp/tmp-2787-KwE6v4ehqlUy/190359341ca2/tldraw.css": {
19550
+ "../../../../../../../tmp/tmp-2968-7h0gdY75JTYT/1903acfa6923/tldraw.css": {
19541
19551
  "bytesInOutput": 75223
19542
19552
  },
19543
- "../../../../../../../tmp/tmp-2787-KwE6v4ehqlUy/190359341680/index.css": {
19553
+ "../../../../../../../tmp/tmp-2968-7h0gdY75JTYT/1903acfa62a1/index.css": {
19544
19554
  "bytesInOutput": 401
19545
19555
  }
19546
19556
  },
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.3.14-alpha.6",
13
+ "version": "0.3.14-alpha.8",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "repository": {
@@ -74,12 +74,12 @@
74
74
  "react": ">=17.0.2 <19.0.0"
75
75
  },
76
76
  "dependencies": {
77
- "@100mslive/hls-player": "0.3.14-alpha.6",
77
+ "@100mslive/hls-player": "0.3.14-alpha.8",
78
78
  "@100mslive/hms-noise-cancellation": "0.0.1",
79
- "@100mslive/hms-virtual-background": "1.13.14-alpha.6",
80
- "@100mslive/hms-whiteboard": "0.0.4-alpha.6",
81
- "@100mslive/react-icons": "0.10.14-alpha.6",
82
- "@100mslive/react-sdk": "0.10.14-alpha.6",
79
+ "@100mslive/hms-virtual-background": "1.13.14-alpha.8",
80
+ "@100mslive/hms-whiteboard": "0.0.4-alpha.8",
81
+ "@100mslive/react-icons": "0.10.14-alpha.8",
82
+ "@100mslive/react-sdk": "0.10.14-alpha.8",
83
83
  "@100mslive/types-prebuilt": "0.12.9",
84
84
  "@emoji-mart/data": "^1.0.6",
85
85
  "@emoji-mart/react": "^1.0.1",
@@ -115,5 +115,5 @@
115
115
  "uuid": "^8.3.2",
116
116
  "worker-timers": "^7.0.40"
117
117
  },
118
- "gitHead": "66c83d117ead187aeacea1da6e46e90a42bbc9d5"
118
+ "gitHead": "16a110b525265ba74c72960c828e6ce933df52cf"
119
119
  }
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable react/prop-types */
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import {
4
+ HMSException,
4
5
  selectDevices,
5
6
  selectLocalAudioTrackID,
6
7
  selectLocalMediaSettings,
@@ -8,7 +9,8 @@ import {
8
9
  useHMSActions,
9
10
  useHMSStore,
10
11
  } from '@100mslive/react-sdk';
11
- import { MicOnIcon, SpeakerIcon } from '@100mslive/react-icons';
12
+ import { MicOnIcon, SpeakerIcon, StopIcon } from '@100mslive/react-icons';
13
+ import { PermissionErrorModal } from '../Prebuilt/components/Notifications/PermissionErrorModal';
12
14
  import { TestContainer, TestFooter } from './components';
13
15
  import { Button } from '../Button';
14
16
  import { Box, Flex } from '../Layout';
@@ -24,15 +26,16 @@ const SelectContainer = ({ children }: { children: React.ReactNode }) => (
24
26
  <Box css={{ w: 'calc(50% - 0.75rem)', '@lg': { w: '100%' } }}>{children}</Box>
25
27
  );
26
28
 
27
- const MicTest = () => {
29
+ const MicTest = ({ setError }: { setError: React.Dispatch<React.SetStateAction<Error | undefined>> }) => {
28
30
  const devices = useHMSStore(selectDevices);
29
31
  const [isRecording, setIsRecording] = useState(false);
30
- const { audioInputDeviceId } = useHMSStore(selectLocalMediaSettings);
31
- const [selectedMic, setSelectedMic] = useState(audioInputDeviceId || 'default');
32
+ const [selectedMic, setSelectedMic] = useState(devices.audioInput[0]?.deviceId || 'default');
32
33
  const trackID = useHMSStore(selectLocalAudioTrackID);
33
34
  const audioLevel = useHMSStore(selectTrackAudioByID(trackID));
34
35
  const { audioOutputDeviceId } = useHMSStore(selectLocalMediaSettings);
35
- const { playing, setPlaying, audioRef } = useAudioOutputTest({ deviceId: audioOutputDeviceId || 'default' });
36
+ const { playing, setPlaying, audioRef } = useAudioOutputTest({
37
+ deviceId: audioOutputDeviceId || devices.audioOutput[0]?.deviceId,
38
+ });
36
39
 
37
40
  return (
38
41
  <SelectContainer>
@@ -44,26 +47,33 @@ const MicTest = () => {
44
47
  onChange={(deviceId: string) => {
45
48
  setSelectedMic(deviceId);
46
49
  hmsDiagnostics.stopMicCheck();
47
- setIsRecording(false);
48
50
  }}
49
51
  />
50
52
  <Flex css={{ gap: '$6', alignItems: 'center' }}>
51
53
  <Button
52
54
  variant="standard"
53
55
  icon
54
- onClick={() =>
55
- hmsDiagnostics
56
- .startMicCheck(selectedMic, () => {
57
- setIsRecording(false);
58
- })
59
- .then(() => {
60
- setIsRecording(true);
61
- })
62
- }
63
- disabled={isRecording}
56
+ onClick={() => {
57
+ isRecording
58
+ ? hmsDiagnostics.stopMicCheck()
59
+ : hmsDiagnostics
60
+ .startMicCheck({
61
+ inputDevice: selectedMic,
62
+ onError: (err: Error) => {
63
+ setError(err);
64
+ },
65
+ onStop: () => {
66
+ setIsRecording(false);
67
+ },
68
+ })
69
+ .then(() => {
70
+ setIsRecording(true);
71
+ });
72
+ }}
73
+ disabled={devices.audioInput.length === 0 || playing}
64
74
  >
65
- <MicOnIcon />
66
- {isRecording ? 'Recording...' : 'Record'}
75
+ {isRecording ? <StopIcon /> : <MicOnIcon />}
76
+ {isRecording ? 'Stop Recording' : 'Record'}
67
77
  </Button>
68
78
 
69
79
  <Button
@@ -120,7 +130,7 @@ const SpeakerTest = () => {
120
130
  <DeviceSelector
121
131
  title="Speaker (Output)"
122
132
  devices={devices.audioOutput}
123
- selection={audioOutputDeviceId || 'default'}
133
+ selection={audioOutputDeviceId || devices.audioOutput[0]?.deviceId}
124
134
  icon={<SpeakerIcon />}
125
135
  onChange={(deviceId: string) => {
126
136
  actions.setAudioOutputDevice(deviceId);
@@ -155,11 +165,12 @@ export const AudioTest = () => {
155
165
  },
156
166
  }}
157
167
  >
158
- {!error && <MicTest />}
168
+ <MicTest setError={setError} />
159
169
  <SpeakerTest />
160
170
  </Flex>
161
171
  </TestContainer>
162
172
  <TestFooter error={error} ctaText="Does your audio sound good?" />
173
+ <PermissionErrorModal error={error as HMSException} />
163
174
  </>
164
175
  );
165
176
  };
@@ -71,6 +71,11 @@ export const browserTypeIconInfo = {
71
71
  val: 'Safari',
72
72
  icon: `${CMS_MEDIA_SERVER}cms/Safari_254e74ed94/Safari_254e74ed94.svg`,
73
73
  },
74
+ 'mobile safari': {
75
+ key: 'safari',
76
+ val: 'Safari',
77
+ icon: `${CMS_MEDIA_SERVER}cms/Safari_254e74ed94/Safari_254e74ed94.svg`,
78
+ },
74
79
  edge: {
75
80
  key: 'edge',
76
81
  val: 'Edge',
@@ -88,11 +93,11 @@ const CheckDetails = ({ title, value, iconURL }: { title: string; value: string;
88
93
  <Text css={{ c: '$on_primary_medium', mb: '$6' }}>{title}</Text>
89
94
  <Flex align="center">
90
95
  {iconURL && (
91
- <Box css={{ size: '2rem', r: '$round', bg: '$surface_brighter' }}>
96
+ <Box css={{ size: '2rem', r: '$round', bg: '$surface_brighter', mr: '$4' }}>
92
97
  <img style={{ objectFit: 'contain', width: '2rem' }} src={iconURL} alt={value} />
93
98
  </Box>
94
99
  )}
95
- <Text css={{ ml: '$4' }}>{value}</Text>
100
+ <Text>{value}</Text>
96
101
  </Flex>
97
102
  </Box>
98
103
  );
@@ -114,7 +119,7 @@ export const BrowserTest = () => {
114
119
  iconURL={
115
120
  parsedUserAgent.getBrowser().name &&
116
121
  browserTypeIconInfo[parsedUserAgent.getBrowser().name?.toLowerCase() as keyof typeof browserTypeIconInfo]
117
- .icon
122
+ ?.icon
118
123
  }
119
124
  value={`${parsedUserAgent.getBrowser().name} ${parsedUserAgent.getBrowser().version}`}
120
125
  />
@@ -123,7 +128,7 @@ export const BrowserTest = () => {
123
128
  iconURL={
124
129
  parsedUserAgent.getOS().name &&
125
130
  operatingSystemIconInfo[parsedUserAgent.getOS().name?.toLowerCase() as keyof typeof operatingSystemIconInfo]
126
- .icon
131
+ ?.icon
127
132
  }
128
133
  value={`${parsedUserAgent.getOS().name} ${parsedUserAgent.getOS().version}`}
129
134
  />
@@ -88,12 +88,15 @@ const DiagnosticsStepsList = () => {
88
88
  const isStepCompleted = activeStepIndex > keyIndex || (activeStep === 'connectivity' && connectivityTested);
89
89
 
90
90
  let color = '$on_primary_low';
91
+ if (activeStep === key) {
92
+ color = '$on_primary_high';
93
+ }
91
94
  if (isStepCompleted) {
92
95
  color = '$primary_bright';
93
96
  }
94
97
 
95
98
  return (
96
- <Flex css={{ mb: '$10', c: color, gap: '$4', alignItems: 'center' }}>
99
+ <Flex key={key} css={{ mb: '$10', c: color, gap: '$4', alignItems: 'center' }}>
97
100
  {isStepCompleted ? (
98
101
  <CheckCircleIcon width="1rem" height="1rem" />
99
102
  ) : (
@@ -1,6 +1,13 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { selectDevices, selectLocalMediaSettings, selectLocalVideoTrackID, useHMSStore } from '@100mslive/react-sdk';
2
+ import {
3
+ HMSException,
4
+ selectDevices,
5
+ selectLocalMediaSettings,
6
+ selectLocalVideoTrackID,
7
+ useHMSStore,
8
+ } from '@100mslive/react-sdk';
3
9
  import { VideoOnIcon } from '@100mslive/react-icons';
10
+ import { PermissionErrorModal } from '../Prebuilt/components/Notifications/PermissionErrorModal';
4
11
  import { TestContainer, TestFooter } from './components';
5
12
  import { Flex } from '../Layout';
6
13
  import { Text } from '../Text';
@@ -15,7 +22,7 @@ export const VideoTest = () => {
15
22
  const { videoInput } = allDevices;
16
23
  const trackID = useHMSStore(selectLocalVideoTrackID);
17
24
  const sdkSelectedDevices = useHMSStore(selectLocalMediaSettings);
18
- const [error, setError] = useState<Error | undefined>();
25
+ const [error, setError] = useState<HMSException | undefined>();
19
26
 
20
27
  useEffect(() => {
21
28
  hmsDiagnostics.startCameraCheck().catch(err => setError(err));
@@ -55,6 +62,7 @@ export const VideoTest = () => {
55
62
  </Flex>
56
63
  </TestContainer>
57
64
  <TestFooter error={error} ctaText="Does your video look good?" />
65
+ <PermissionErrorModal error={error} />
58
66
  </>
59
67
  );
60
68
  };
@@ -24,7 +24,7 @@ import { ChatNotifications } from './ChatNotifications';
24
24
  import { HandRaisedNotifications } from './HandRaisedNotifications';
25
25
  import { InitErrorModal } from './InitErrorModal';
26
26
  import { PeerNotifications } from './PeerNotifications';
27
- import { PermissionErrorModal } from './PermissionErrorModal';
27
+ import { PermissionErrorNotificationModal } from './PermissionErrorModal';
28
28
  import { ReconnectNotifications } from './ReconnectNotifications';
29
29
  import { TrackBulkUnmuteModal } from './TrackBulkUnmuteModal';
30
30
  import { TrackNotifications } from './TrackNotifications';
@@ -197,7 +197,7 @@ export function Notifications() {
197
197
  {roomState === HMSRoomState.Connected ? <PeerNotifications /> : null}
198
198
  <ReconnectNotifications />
199
199
  <AutoplayBlockedModal />
200
- <PermissionErrorModal />
200
+ <PermissionErrorNotificationModal />
201
201
  <InitErrorModal />
202
202
  <ChatNotifications />
203
203
  <HandRaisedNotifications />
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { useMedia } from 'react-use';
3
- import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
3
+ import { HMSException, HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
4
4
  import { Button, config as cssConfig, Dialog, Flex, Text } from '../../..';
5
5
  // @ts-ignore: No implicit Any
6
6
  import androidPermissionAlert from '../../images/android-perm-1.png';
@@ -9,22 +9,24 @@ import iosPermissions from '../../images/ios-perm-0.png';
9
9
  // @ts-ignore: No implicit Any
10
10
  import { isAndroid, isIOS } from '../../common/constants';
11
11
 
12
- export function PermissionErrorModal() {
12
+ export function PermissionErrorNotificationModal() {
13
13
  const notification = useHMSNotifications(HMSNotificationTypes.ERROR);
14
+ return <PermissionErrorModal error={notification?.data} />;
15
+ }
16
+
17
+ export const PermissionErrorModal = ({ error }: { error?: HMSException }) => {
14
18
  const [deviceType, setDeviceType] = useState('');
15
19
  const [isSystemError, setIsSystemError] = useState(false);
16
20
  const isMobile = useMedia(cssConfig.media.md);
17
-
18
21
  useEffect(() => {
19
22
  if (
20
- !notification ||
21
- (notification.data?.code !== 3001 && notification.data?.code !== 3011) ||
22
- (notification.data?.code === 3001 && notification.data?.message.includes('screen'))
23
+ !error ||
24
+ (error?.code !== 3001 && error?.code !== 3011) ||
25
+ (error?.code === 3001 && error?.message.includes('screen'))
23
26
  ) {
24
27
  return;
25
28
  }
26
- console.error(`[${notification.type}]`, notification);
27
- const errorMessage = notification.data?.message;
29
+ const errorMessage = error?.message;
28
30
  const hasAudio = errorMessage.includes('audio');
29
31
  const hasVideo = errorMessage.includes('video');
30
32
  const hasScreen = errorMessage.includes('screen');
@@ -37,8 +39,8 @@ export function PermissionErrorModal() {
37
39
  } else if (hasScreen) {
38
40
  setDeviceType('screen');
39
41
  }
40
- setIsSystemError(notification.data.code === 3011);
41
- }, [notification]);
42
+ setIsSystemError(error.code === 3011);
43
+ }, [error]);
42
44
 
43
45
  return deviceType ? (
44
46
  <Dialog.Root open={!!deviceType}>
@@ -131,4 +133,4 @@ export function PermissionErrorModal() {
131
133
  </Dialog.Portal>
132
134
  </Dialog.Root>
133
135
  ) : null;
134
- }
136
+ };