@cuemath/leap 3.4.5-aa0 → 3.4.5-aa5

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.
@@ -1,44 +1,47 @@
1
- import { jsxs as o, jsx as e, Fragment as X } from "react/jsx-runtime";
2
- import { memo as w, useRef as P, useCallback as p, useEffect as V } from "react";
3
- import m from "../../ui/inputs/select-input/select-input.js";
4
- import t from "../../ui/layout/flex-view.js";
5
- import $ from "../../ui/text/text.js";
6
- import { AVErrorSOPWrapper as O, AVErrorStepList as E } from "./av-preview-styled.js";
7
- import S from "./hooks/use-get-troubleshooting-steps.js";
8
- import G from "./hooks/use-media-devices.js";
9
- const I = w(({ children: b, onDeviceUpdate: h, logger: A }) => {
10
- const v = P(null), {
11
- devices: n,
12
- selectedAudioDevice: s,
13
- selectedVideoDevice: d,
14
- selectedAudioOutputDevice: a,
15
- changeDevice: r,
16
- changeAudioOutputDevice: f,
17
- audioDeviceError: l,
18
- videoDeviceError: u
19
- } = G(v, A), g = u === "permissionDeniedBySystem" || u === "permissionDenied" || l === "permissionDeniedBySystem" || l === "permissionDenied", c = S(l, u), D = p(
20
- (i) => r(i, "audio"),
21
- [r]
22
- ), x = p(
23
- (i) => r(i, "video"),
24
- [r]
25
- ), y = p(
1
+ import { jsxs as s, jsx as e, Fragment as _ } from "react/jsx-runtime";
2
+ import { useUserMedia as w } from "@cuemath/av";
3
+ import { memo as P, useRef as S, useCallback as m, useEffect as X } from "react";
4
+ import h from "../../ui/inputs/select-input/select-input.js";
5
+ import a from "../../ui/layout/flex-view.js";
6
+ import b from "../../ui/text/text.js";
7
+ import { AVErrorSOPWrapper as O, AVErrorStepList as V } from "./av-preview-styled.js";
8
+ import E from "./hooks/use-get-troubleshooting-steps.js";
9
+ const k = { audio: !0, video: !0 }, I = P(({ children: $, logger: v }) => {
10
+ const n = S(null), {
11
+ selectedAudioDevice: g,
12
+ selectedVideoDevice: A,
13
+ videoDeviceError: d,
14
+ devices: u,
15
+ changeDevice: o,
16
+ selectedAudioOutputDevice: D,
17
+ audioDeviceError: c,
18
+ userMedia: l
19
+ } = w(k), f = d === "permissionDeniedBySystem" || d === "permissionDenied" || c === "permissionDeniedBySystem" || c === "permissionDenied", p = E(c, d), x = m(
20
+ (i) => o(i, "audio"),
21
+ [o]
22
+ ), y = m(
23
+ (i) => o(i, "video"),
24
+ [o]
25
+ ), C = m(
26
26
  (i) => {
27
- f(i);
27
+ const t = n.current;
28
+ o(i, "audiooutput"), t && "setSinkId" in t && t.setSinkId(i).catch((r) => {
29
+ v("av_preview_set_audio_output_device_error", {
30
+ deviceId: i,
31
+ error_name: r == null ? void 0 : r.name,
32
+ error_message: r == null ? void 0 : r.message
33
+ });
34
+ });
28
35
  },
29
- [f]
36
+ [o, v]
30
37
  );
31
- return V(() => {
32
- h({
33
- audio: s,
34
- video: d,
35
- audioOutput: a
36
- });
37
- }, [s, d, a, h]), /* @__PURE__ */ o(t, { $flexDirection: "row", $flexGapX: 2, children: [
38
- /* @__PURE__ */ e(t, { $widthX: 26, $heightX: 19.5, $background: "BLACK_1", children: /* @__PURE__ */ e(
38
+ return X(() => {
39
+ n.current && l && (n.current.srcObject = l);
40
+ }, [l]), /* @__PURE__ */ s(a, { $flexDirection: "row", $flexGapX: 2, children: [
41
+ /* @__PURE__ */ e(a, { $widthX: 26, $heightX: 19.5, $background: "BLACK_1", children: /* @__PURE__ */ e(
39
42
  "video",
40
43
  {
41
- ref: v,
44
+ ref: n,
42
45
  id: "localVideo",
43
46
  autoPlay: !0,
44
47
  playsInline: !0,
@@ -47,60 +50,60 @@ const I = w(({ children: b, onDeviceUpdate: h, logger: A }) => {
47
50
  disablePictureInPicture: !0
48
51
  }
49
52
  ) }),
50
- /* @__PURE__ */ o(t, { $position: "relative", $widthX: 22, $flexGapX: 1, $justifyContent: "space-between", children: [
51
- /* @__PURE__ */ e(t, { $flexGapX: 1, children: !g && /* @__PURE__ */ o(X, { children: [
53
+ /* @__PURE__ */ s(a, { $position: "relative", $widthX: 22, $flexGapX: 1, $justifyContent: "space-between", children: [
54
+ /* @__PURE__ */ e(a, { $flexGapX: 1, children: !f && /* @__PURE__ */ s(_, { children: [
52
55
  /* @__PURE__ */ e(
53
- m,
56
+ h,
54
57
  {
55
58
  label: "Camera",
56
59
  renderAs: "primary",
57
60
  shape: "borderLess",
58
- options: n.video,
59
- value: d,
60
- onChange: x
61
+ options: u.video,
62
+ value: A,
63
+ onChange: y
61
64
  }
62
65
  ),
63
66
  /* @__PURE__ */ e(
64
- m,
67
+ h,
65
68
  {
66
69
  label: "Microphone",
67
70
  renderAs: "primary",
68
71
  shape: "borderLess",
69
- options: n.audio,
70
- value: s,
71
- onChange: D
72
+ options: u.audio,
73
+ value: g,
74
+ onChange: x
72
75
  }
73
76
  ),
74
77
  /* @__PURE__ */ e(
75
- m,
78
+ h,
76
79
  {
77
80
  label: "Speaker",
78
81
  renderAs: "primary",
79
82
  shape: "borderLess",
80
- options: n.audioOutput,
81
- value: a,
82
- onChange: y
83
+ options: u.audioOutput,
84
+ value: D,
85
+ onChange: C
83
86
  }
84
87
  ),
85
- /* @__PURE__ */ e("div", { children: b })
88
+ /* @__PURE__ */ e("div", { children: $ })
86
89
  ] }) }),
87
- c && /* @__PURE__ */ o(
90
+ p && /* @__PURE__ */ s(
88
91
  O,
89
92
  {
90
93
  $background: "ORANGE_2",
91
94
  $gutterX: 1,
92
95
  $gapX: 1,
93
- $width: g ? "100%" : "272px",
96
+ $width: f ? "100%" : "272px",
94
97
  children: [
95
- /* @__PURE__ */ e($, { $renderAs: "ab1-bold", $marginBottomX: 1, children: c.heading }),
96
- /* @__PURE__ */ e(E, { children: c.steps.map((i, C) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e($, { $renderAs: "ub1", children: i }) }, C)) })
98
+ /* @__PURE__ */ e(b, { $renderAs: "ab1-bold", $marginBottomX: 1, children: p.heading }),
99
+ /* @__PURE__ */ e(V, { children: p.steps.map((i, t) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(b, { $renderAs: "ub1", children: i }) }, t)) })
97
100
  ]
98
101
  }
99
102
  )
100
103
  ] })
101
104
  ] });
102
- }), _ = I;
105
+ }), N = I;
103
106
  export {
104
- _ as default
107
+ N as default
105
108
  };
106
109
  //# sourceMappingURL=av-preview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"av-preview.js","sources":["../../../../src/features/av/av-preview/av-preview.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { memo, useCallback, useEffect, useRef } from 'react';\n\nimport SelectInput from '../../ui/inputs/select-input/select-input';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport * as Styled from './av-preview-styled';\nimport type { ILogger } from './av-preview-types';\nimport useGetTroubleshootingInfo from './hooks/use-get-troubleshooting-steps';\nimport useMediaDevices from './hooks/use-media-devices';\n\ninterface IAVPreviewProps {\n children?: React.ReactNode;\n onDeviceUpdate: (selectedDevices: {\n audio?: string;\n video?: string;\n audioOutput?: string;\n }) => void;\n logger: ILogger;\n}\n\nconst AVPreview: FC<IAVPreviewProps> = memo(({ children, onDeviceUpdate, logger }) => {\n const videoRef = useRef<HTMLVideoElement>(null);\n const {\n devices,\n selectedAudioDevice,\n selectedVideoDevice,\n selectedAudioOutputDevice,\n changeDevice,\n changeAudioOutputDevice,\n audioDeviceError,\n videoDeviceError,\n } = useMediaDevices(videoRef, logger);\n const hasPermissionProblem =\n videoDeviceError === 'permissionDeniedBySystem' ||\n videoDeviceError === 'permissionDenied' ||\n audioDeviceError === 'permissionDeniedBySystem' ||\n audioDeviceError === 'permissionDenied';\n const troubleshootingInfo = useGetTroubleshootingInfo(audioDeviceError, videoDeviceError);\n\n const handleAudioDeviceChange = useCallback(\n (deviceId: string) => changeDevice(deviceId, 'audio'),\n [changeDevice],\n );\n\n const handleVideoDeviceChange = useCallback(\n (deviceId: string) => changeDevice(deviceId, 'video'),\n [changeDevice],\n );\n\n const handleAudioOutputDeviceChange = useCallback(\n (deviceId: string) => {\n changeAudioOutputDevice(deviceId);\n },\n [changeAudioOutputDevice],\n );\n\n // Call onDeviceUpdate when devices or selected devices change\n useEffect(() => {\n onDeviceUpdate({\n audio: selectedAudioDevice,\n video: selectedVideoDevice,\n audioOutput: selectedAudioOutputDevice,\n });\n }, [selectedAudioDevice, selectedVideoDevice, selectedAudioOutputDevice, onDeviceUpdate]);\n\n return (\n <FlexView $flexDirection=\"row\" $flexGapX={2}>\n <FlexView $widthX={26} $heightX={19.5} $background=\"BLACK_1\">\n <video\n ref={videoRef}\n id=\"localVideo\"\n autoPlay\n playsInline\n controls={false}\n muted={true}\n disablePictureInPicture\n />\n </FlexView>\n <FlexView $position=\"relative\" $widthX={22} $flexGapX={1} $justifyContent=\"space-between\">\n <FlexView $flexGapX={1}>\n {!hasPermissionProblem && (\n <>\n <SelectInput\n label=\"Camera\"\n renderAs=\"primary\"\n shape=\"borderLess\"\n options={devices.video}\n value={selectedVideoDevice}\n onChange={handleVideoDeviceChange}\n />\n <SelectInput\n label=\"Microphone\"\n renderAs=\"primary\"\n shape=\"borderLess\"\n options={devices.audio}\n value={selectedAudioDevice}\n onChange={handleAudioDeviceChange}\n />\n <SelectInput\n label=\"Speaker\"\n renderAs=\"primary\"\n shape=\"borderLess\"\n options={devices.audioOutput}\n value={selectedAudioOutputDevice}\n onChange={handleAudioOutputDeviceChange}\n />\n <div>{children}</div>\n </>\n )}\n </FlexView>\n {troubleshootingInfo && (\n <Styled.AVErrorSOPWrapper\n $background=\"ORANGE_2\"\n $gutterX={1}\n $gapX={1}\n $width={hasPermissionProblem ? '100%' : '272px'}\n >\n <Text $renderAs=\"ab1-bold\" $marginBottomX={1}>\n {troubleshootingInfo.heading}\n </Text>\n <Styled.AVErrorStepList>\n {troubleshootingInfo.steps.map((step, index) => (\n <li key={index}>\n <Text $renderAs=\"ub1\">{step}</Text>\n </li>\n ))}\n </Styled.AVErrorStepList>\n </Styled.AVErrorSOPWrapper>\n )}\n </FlexView>\n </FlexView>\n );\n});\n\nexport default AVPreview;\n"],"names":["AVPreview","memo","children","onDeviceUpdate","logger","videoRef","useRef","devices","selectedAudioDevice","selectedVideoDevice","selectedAudioOutputDevice","changeDevice","changeAudioOutputDevice","audioDeviceError","videoDeviceError","useMediaDevices","hasPermissionProblem","troubleshootingInfo","useGetTroubleshootingInfo","handleAudioDeviceChange","useCallback","deviceId","handleVideoDeviceChange","handleAudioOutputDeviceChange","useEffect","jsxs","FlexView","jsx","Fragment","SelectInput","Styled.AVErrorSOPWrapper","Text","Styled.AVErrorStepList","step","index","AVPreview$1"],"mappings":";;;;;;;;AAqBA,MAAMA,IAAiCC,EAAK,CAAC,EAAE,UAAAC,GAAU,gBAAAC,GAAgB,QAAAC,QAAa;AAC9E,QAAAC,IAAWC,EAAyB,IAAI,GACxC;AAAA,IACJ,SAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,cAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,kBAAAC;AAAA,EAAA,IACEC,EAAgBV,GAAUD,CAAM,GAC9BY,IACJF,MAAqB,8BACrBA,MAAqB,sBACrBD,MAAqB,8BACrBA,MAAqB,oBACjBI,IAAsBC,EAA0BL,GAAkBC,CAAgB,GAElFK,IAA0BC;AAAA,IAC9B,CAACC,MAAqBV,EAAaU,GAAU,OAAO;AAAA,IACpD,CAACV,CAAY;AAAA,EAAA,GAGTW,IAA0BF;AAAA,IAC9B,CAACC,MAAqBV,EAAaU,GAAU,OAAO;AAAA,IACpD,CAACV,CAAY;AAAA,EAAA,GAGTY,IAAgCH;AAAA,IACpC,CAACC,MAAqB;AACpB,MAAAT,EAAwBS,CAAQ;AAAA,IAClC;AAAA,IACA,CAACT,CAAuB;AAAA,EAAA;AAI1B,SAAAY,EAAU,MAAM;AACC,IAAArB,EAAA;AAAA,MACb,OAAOK;AAAA,MACP,OAAOC;AAAA,MACP,aAAaC;AAAA,IAAA,CACd;AAAA,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ACK;AAAAA,QAAA;AAAA,UACC,aAAY;AAAA,UACZ,UAAU;AAAA,UACV,OAAO;AAAA,UACP,QAAQd,IAAuB,SAAS;AAAA,UAExC,UAAA;AAAA,YAAA,gBAAAW,EAACI,KAAK,WAAU,YAAW,gBAAgB,GACxC,YAAoB,SACvB;AAAA,YACA,gBAAAJ,EAACK,GAAA,EACE,YAAoB,MAAM,IAAI,CAACC,GAAMC,wBACnC,MACC,EAAA,UAAA,gBAAAP,EAACI,KAAK,WAAU,OAAO,aAAK,EADrB,GAAAG,CAET,CACD,EACH,CAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GAEJ;AAAA,EACF,EAAA,CAAA;AAEJ,CAAC,GAEDC,IAAenC;"}
1
+ {"version":3,"file":"av-preview.js","sources":["../../../../src/features/av/av-preview/av-preview.tsx"],"sourcesContent":["import { useUserMedia } from '@cuemath/av';\nimport type { FC } from 'react';\nimport { memo, useCallback, useEffect, useRef } from 'react';\n\nimport SelectInput from '../../ui/inputs/select-input/select-input';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport * as Styled from './av-preview-styled';\nimport type { ILogger } from './av-preview-types';\nimport useGetTroubleshootingInfo from './hooks/use-get-troubleshooting-steps';\n\ninterface IAVPreviewProps {\n children?: React.ReactNode;\n logger: ILogger;\n}\nconst OPTIONS = { audio: true, video: true };\n\nconst AVPreview: FC<IAVPreviewProps> = memo(({ children, logger }) => {\n const videoRef = useRef<HTMLVideoElement>(null);\n const {\n selectedAudioDevice,\n selectedVideoDevice,\n videoDeviceError,\n devices,\n changeDevice,\n selectedAudioOutputDevice,\n audioDeviceError,\n userMedia,\n } = useUserMedia(OPTIONS);\n\n const hasPermissionProblem =\n videoDeviceError === 'permissionDeniedBySystem' ||\n videoDeviceError === 'permissionDenied' ||\n audioDeviceError === 'permissionDeniedBySystem' ||\n audioDeviceError === 'permissionDenied';\n const troubleshootingInfo = useGetTroubleshootingInfo(audioDeviceError, videoDeviceError);\n\n const handleAudioDeviceChange = useCallback(\n (deviceId: string) => changeDevice(deviceId, 'audio'),\n [changeDevice],\n );\n\n const handleVideoDeviceChange = useCallback(\n (deviceId: string) => changeDevice(deviceId, 'video'),\n [changeDevice],\n );\n\n const handleAudioOutputDeviceChange = useCallback(\n (deviceId: string) => {\n const videoEl = videoRef.current;\n\n changeDevice(deviceId, 'audiooutput');\n if (videoEl && 'setSinkId' in videoEl) {\n videoEl.setSinkId(deviceId).catch(error => {\n logger('av_preview_set_audio_output_device_error', {\n deviceId,\n error_name: error?.name,\n error_message: error?.message,\n });\n });\n }\n },\n [changeDevice, logger],\n );\n\n useEffect(() => {\n if (videoRef.current && userMedia) {\n videoRef.current.srcObject = userMedia;\n }\n }, [userMedia]);\n\n return (\n <FlexView $flexDirection=\"row\" $flexGapX={2}>\n <FlexView $widthX={26} $heightX={19.5} $background=\"BLACK_1\">\n <video\n ref={videoRef}\n id=\"localVideo\"\n autoPlay\n playsInline\n controls={false}\n muted={true}\n disablePictureInPicture\n />\n </FlexView>\n <FlexView $position=\"relative\" $widthX={22} $flexGapX={1} $justifyContent=\"space-between\">\n <FlexView $flexGapX={1}>\n {!hasPermissionProblem && (\n <>\n <SelectInput\n label=\"Camera\"\n renderAs=\"primary\"\n shape=\"borderLess\"\n options={devices.video}\n value={selectedVideoDevice}\n onChange={handleVideoDeviceChange}\n />\n <SelectInput\n label=\"Microphone\"\n renderAs=\"primary\"\n shape=\"borderLess\"\n options={devices.audio}\n value={selectedAudioDevice}\n onChange={handleAudioDeviceChange}\n />\n <SelectInput\n label=\"Speaker\"\n renderAs=\"primary\"\n shape=\"borderLess\"\n options={devices.audioOutput}\n value={selectedAudioOutputDevice}\n onChange={handleAudioOutputDeviceChange}\n />\n <div>{children}</div>\n </>\n )}\n </FlexView>\n {troubleshootingInfo && (\n <Styled.AVErrorSOPWrapper\n $background=\"ORANGE_2\"\n $gutterX={1}\n $gapX={1}\n $width={hasPermissionProblem ? '100%' : '272px'}\n >\n <Text $renderAs=\"ab1-bold\" $marginBottomX={1}>\n {troubleshootingInfo.heading}\n </Text>\n <Styled.AVErrorStepList>\n {troubleshootingInfo.steps.map((step, index) => (\n <li key={index}>\n <Text $renderAs=\"ub1\">{step}</Text>\n </li>\n ))}\n </Styled.AVErrorStepList>\n </Styled.AVErrorSOPWrapper>\n )}\n </FlexView>\n </FlexView>\n );\n});\n\nexport default AVPreview;\n"],"names":["OPTIONS","AVPreview","memo","children","logger","videoRef","useRef","selectedAudioDevice","selectedVideoDevice","videoDeviceError","devices","changeDevice","selectedAudioOutputDevice","audioDeviceError","userMedia","useUserMedia","hasPermissionProblem","troubleshootingInfo","useGetTroubleshootingInfo","handleAudioDeviceChange","useCallback","deviceId","handleVideoDeviceChange","handleAudioOutputDeviceChange","videoEl","error","useEffect","jsxs","FlexView","jsx","Fragment","SelectInput","Styled.AVErrorSOPWrapper","Text","Styled.AVErrorStepList","step","index","AVPreview$1"],"mappings":";;;;;;;;AAeA,MAAMA,IAAU,EAAE,OAAO,IAAM,OAAO,GAAK,GAErCC,IAAiCC,EAAK,CAAC,EAAE,UAAAC,GAAU,QAAAC,QAAa;AAC9D,QAAAC,IAAWC,EAAyB,IAAI,GACxC;AAAA,IACJ,qBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,WAAAC;AAAA,EAAA,IACEC,EAAaf,CAAO,GAElBgB,IACJP,MAAqB,8BACrBA,MAAqB,sBACrBI,MAAqB,8BACrBA,MAAqB,oBACjBI,IAAsBC,EAA0BL,GAAkBJ,CAAgB,GAElFU,IAA0BC;AAAA,IAC9B,CAACC,MAAqBV,EAAaU,GAAU,OAAO;AAAA,IACpD,CAACV,CAAY;AAAA,EAAA,GAGTW,IAA0BF;AAAA,IAC9B,CAACC,MAAqBV,EAAaU,GAAU,OAAO;AAAA,IACpD,CAACV,CAAY;A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,gBAAAO;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,OAAM;AAAA,YACN,UAAS;AAAA,YACT,OAAM;AAAA,YACN,SAASrB,EAAQ;AAAA,YACjB,OAAOH;AAAA,YACP,UAAUY;AAAA,UAAA;AAAA,QACZ;AAAA,QACA,gBAAAU;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,OAAM;AAAA,YACN,UAAS;AAAA,YACT,OAAM;AAAA,YACN,SAASrB,EAAQ;AAAA,YACjB,OAAOE;AAAA,YACP,UAAUW;AAAA,UAAA;AAAA,QACZ;AAAA,QACA,gBAAAM,EAAC,SAAK,UAAA1B,GAAS;AAAA,MAAA,EAAA,CACjB,EAEJ,CAAA;AAAA,MACCc,KACC,gBAAAU;AAAA,QAACK;AAAAA,QAAA;AAAA,UACC,aAAY;AAAA,UACZ,UAAU;AAAA,UACV,OAAO;AAAA,UACP,QAAQhB,IAAuB,SAAS;AAAA,UAExC,UAAA;AAAA,YAAA,gBAAAa,EAACI,KAAK,WAAU,YAAW,gBAAgB,GACxC,YAAoB,SACvB;AAAA,YACA,gBAAAJ,EAACK,GAAA,EACE,YAAoB,MAAM,IAAI,CAACC,GAAMC,wBACnC,MACC,EAAA,UAAA,gBAAAP,EAACI,KAAK,WAAU,OAAO,aAAK,EADrB,GAAAG,CAET,CACD,EACH,CAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GAEJ;AAAA,EACF,EAAA,CAAA;AAEJ,CAAC,GAEDC,IAAepC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-get-troubleshooting-steps.js","sources":["../../../../../src/features/av/av-preview/hooks/use-get-troubleshooting-steps.ts"],"sourcesContent":["import { type TDeviceError } from '@cuemath/av/dist/types';\n\ninterface IUseGetTroubleshootingInfo {\n (\n audioDeviceError?: TDeviceError,\n videoDeviceError?: TDeviceError,\n ):\n | {\n heading: string;\n steps: string[];\n imageElement?: React.ReactNode;\n }\n | undefined;\n}\n\n// window.location='x-apple.systempreferences:com.apple.preference.security?Privacy_Camera'\n// window.location='x-apple.systempreferences:com.apple.preference.security?Privacy_Microphone'\n\nconst useGetTroubleshootingInfo: IUseGetTroubleshootingInfo = (\n audioDeviceError,\n videoDeviceError,\n) => {\n switch (videoDeviceError) {\n case 'permissionDeniedBySystem':\n return {\n heading: 'Please allow your browser to access your camera from your system setting.',\n steps: [\n 'Open your system settings.',\n 'Navigate to Privacy & Security.',\n 'Find Camera permissions and ensure the browser is allowed access.',\n ],\n };\n case 'permissionDenied':\n return {\n heading: 'Please allow your browser to access your camera.',\n steps: [\n 'Click on the lock icon in the address bar.',\n 'Select \"Site settings\".',\n 'Find Camera permissions and ensure it is set to \"Allow\".',\n ],\n };\n case 'deviceNotFound':\n return {\n heading: 'No camera found',\n steps: [\n 'Ensure your camera is connected and turned on.',\n 'If you are using an external camera, check the connection.',\n 'Try refreshing the page or restarting your browser.',\n ],\n };\n case 'thirdPartyApps':\n return {\n heading: 'Camera is being used by another application',\n steps: [\n 'Close any other applications that might be using the camera.',\n 'Try refreshing the page or restarting your browser.',\n ],\n };\n case 'other':\n return {\n heading: 'An unknown error occurred with the camera',\n steps: [\n 'Try refreshing the page or restarting your browser.',\n 'Check if your camera is working in other applications.',\n 'If the issue persists, try using a different browser or device.',\n ],\n };\n }\n\n switch (audioDeviceError) {\n case 'permissionDeniedBySystem':\n return {\n heading: 'Please allow your browser to access your microphone from your system setting.',\n steps: [\n 'Open your system settings.',\n 'Navigate to Privacy & Security.',\n 'Find Microphone permissions and ensure the browser is allowed access.',\n ],\n };\n case 'permissionDenied':\n return {\n heading: 'Please allow your browser to access your microphone.',\n steps: [\n 'Click on the lock icon in the address bar.',\n 'Select \"Site settings\".',\n 'Find Microphone permissions and ensure it is set to \"Allow\".',\n ],\n };\n case 'deviceNotFound':\n return {\n heading: 'No microphone found',\n steps: [\n 'Ensure your microphone is connected and turned on.',\n 'If you are using an external microphone, check the connection.',\n 'Try refreshing the page or restarting your browser.',\n ],\n };\n case 'thirdPartyApps':\n return {\n heading: 'Microphone is being used by another application',\n steps: [\n 'Close any other applications that might be using the microphone.',\n 'Try refreshing the page or restarting your browser.',\n ],\n };\n case 'other':\n return {\n heading: 'An unknown error occurred with the microphone',\n steps: ['Try refreshing the page or restarting your browser.'],\n };\n }\n};\n\nexport default useGetTroubleshootingInfo;\n"],"names":["useGetTroubleshootingInfo","audioDeviceError","videoDeviceError"],"mappings":"AAkBM,MAAAA,IAAwD,CAC5DC,GACAC,MACG;AACH,UAAQA,GAAkB;AAAA,IACxB,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,EAEN;AAEA,UAAQD,GAAkB;AAAA,IACxB,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO,CAAC,qDAAqD;AAAA,MAAA;AAAA,EAEnE;AACF;"}
1
+ {"version":3,"file":"use-get-troubleshooting-steps.js","sources":["../../../../../src/features/av/av-preview/hooks/use-get-troubleshooting-steps.ts"],"sourcesContent":["import { type TDeviceError } from '@cuemath/av/dist/core/media-manager/types';\n\ninterface IUseGetTroubleshootingInfo {\n (\n audioDeviceError?: TDeviceError,\n videoDeviceError?: TDeviceError,\n ):\n | {\n heading: string;\n steps: string[];\n imageElement?: React.ReactNode;\n }\n | undefined;\n}\n\n// window.location='x-apple.systempreferences:com.apple.preference.security?Privacy_Camera'\n// window.location='x-apple.systempreferences:com.apple.preference.security?Privacy_Microphone'\n\nconst useGetTroubleshootingInfo: IUseGetTroubleshootingInfo = (\n audioDeviceError,\n videoDeviceError,\n) => {\n switch (videoDeviceError) {\n case 'permissionDeniedBySystem':\n return {\n heading: 'Please allow your browser to access your camera from your system setting.',\n steps: [\n 'Open your system settings.',\n 'Navigate to Privacy & Security.',\n 'Find Camera permissions and ensure the browser is allowed access.',\n ],\n };\n case 'permissionDenied':\n return {\n heading: 'Please allow your browser to access your camera.',\n steps: [\n 'Click on the lock icon in the address bar.',\n 'Select \"Site settings\".',\n 'Find Camera permissions and ensure it is set to \"Allow\".',\n ],\n };\n case 'deviceNotFound':\n return {\n heading: 'No camera found',\n steps: [\n 'Ensure your camera is connected and turned on.',\n 'If you are using an external camera, check the connection.',\n 'Try refreshing the page or restarting your browser.',\n ],\n };\n case 'thirdPartyApps':\n return {\n heading: 'Camera is being used by another application',\n steps: [\n 'Close any other applications that might be using the camera.',\n 'Try refreshing the page or restarting your browser.',\n ],\n };\n case 'other':\n return {\n heading: 'An unknown error occurred with the camera',\n steps: [\n 'Try refreshing the page or restarting your browser.',\n 'Check if your camera is working in other applications.',\n 'If the issue persists, try using a different browser or device.',\n ],\n };\n }\n\n switch (audioDeviceError) {\n case 'permissionDeniedBySystem':\n return {\n heading: 'Please allow your browser to access your microphone from your system setting.',\n steps: [\n 'Open your system settings.',\n 'Navigate to Privacy & Security.',\n 'Find Microphone permissions and ensure the browser is allowed access.',\n ],\n };\n case 'permissionDenied':\n return {\n heading: 'Please allow your browser to access your microphone.',\n steps: [\n 'Click on the lock icon in the address bar.',\n 'Select \"Site settings\".',\n 'Find Microphone permissions and ensure it is set to \"Allow\".',\n ],\n };\n case 'deviceNotFound':\n return {\n heading: 'No microphone found',\n steps: [\n 'Ensure your microphone is connected and turned on.',\n 'If you are using an external microphone, check the connection.',\n 'Try refreshing the page or restarting your browser.',\n ],\n };\n case 'thirdPartyApps':\n return {\n heading: 'Microphone is being used by another application',\n steps: [\n 'Close any other applications that might be using the microphone.',\n 'Try refreshing the page or restarting your browser.',\n ],\n };\n case 'other':\n return {\n heading: 'An unknown error occurred with the microphone',\n steps: ['Try refreshing the page or restarting your browser.'],\n };\n }\n};\n\nexport default useGetTroubleshootingInfo;\n"],"names":["useGetTroubleshootingInfo","audioDeviceError","videoDeviceError"],"mappings":"AAkBM,MAAAA,IAAwD,CAC5DC,GACAC,MACG;AACH,UAAQA,GAAkB;AAAA,IACxB,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,EAEN;AAEA,UAAQD,GAAkB;AAAA,IACxB,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO;AAAA,UACL;AAAA,UACA;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,KAAK;AACI,aAAA;AAAA,QACL,SAAS;AAAA,QACT,OAAO,CAAC,qDAAqD;AAAA,MAAA;AAAA,EAEnE;AACF;"}
package/dist/index.d.ts CHANGED
@@ -942,11 +942,6 @@ declare interface IAvatarProps {
942
942
 
943
943
  declare interface IAVPreviewProps {
944
944
  children?: React.ReactNode;
945
- onDeviceUpdate: (selectedDevices: {
946
- audio?: string;
947
- video?: string;
948
- audioOutput?: string;
949
- }) => void;
950
945
  logger: ILogger;
951
946
  }
952
947
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "3.4.5-aa0",
3
+ "version": "3.4.5-aa5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -32,7 +32,7 @@
32
32
  "sideEffects": false,
33
33
  "devDependencies": {
34
34
  "@100mslive/hms-video-store": "0.10.8",
35
- "@cuemath/av": "2.0.0-mm2",
35
+ "@cuemath/av": "2.0.0-mm12",
36
36
  "@cuemath/cue-message-broker": "1.0.37",
37
37
  "@cuemath/eslint-config": "1.1.0",
38
38
  "@cuemath/prettier-config": "1.0.4",
@@ -1,78 +0,0 @@
1
- import { useMediaManager as w } from "@cuemath/av";
2
- import { useState as a, useCallback as n, useEffect as v } from "react";
3
- const E = (c, o) => {
4
- const [u, A] = a(), [d, _] = a(), [g, D] = a(), [S, m] = a(), [h, l] = a({
5
- audio: [],
6
- video: [],
7
- audioOutput: []
8
- }), [M, O] = a(), i = w(), p = n(
9
- (e, t) => {
10
- o("av_preview_error", { error: e }), t === "microphone" ? A(e) : t === "camera" && _(e);
11
- },
12
- [o]
13
- ), f = n(() => {
14
- const { audioDeviceId: e, videoDeviceId: t } = i.getSelectedDeviceDetails();
15
- D(e), m(t);
16
- }, [i]), r = n(
17
- (e) => {
18
- l(e || i.getAvailableDevices()), f();
19
- },
20
- [f, i]
21
- );
22
- v(() => (i.addDevicesChangeListener(r), () => {
23
- i.addDevicesChangeListener(void 0);
24
- }), [i, r]), v(() => {
25
- !u && !d && c.current;
26
- }), v(() => {
27
- async function e() {
28
- if (!u || !d) {
29
- const t = await i.initializeUserMedia({
30
- onError: p,
31
- constraints: { audio: !0, video: !0 }
32
- });
33
- r(), c.current && t && (c.current.srcObject = t);
34
- }
35
- }
36
- e();
37
- }, [
38
- u,
39
- i,
40
- p,
41
- r,
42
- d,
43
- c
44
- ]);
45
- const b = n(
46
- async (e, t) => {
47
- !i || !e || (i.changeSelectedDevice(e, t), t === "video" ? m(e) : t === "audio" && D(e));
48
- },
49
- [i]
50
- ), k = n(
51
- (e) => {
52
- i.setAudioOutputDevice(e), O(e);
53
- const t = c.current;
54
- t && "setSinkId" in t && t.setSinkId(e).catch((s) => {
55
- o("av_preview_set_audio_output_device_error", {
56
- deviceId: e,
57
- error_name: s == null ? void 0 : s.name,
58
- error_message: s == null ? void 0 : s.message
59
- });
60
- });
61
- },
62
- [c, i, o]
63
- );
64
- return {
65
- audioDeviceError: u,
66
- videoDeviceError: d,
67
- devices: h,
68
- selectedVideoDevice: S,
69
- selectedAudioDevice: g,
70
- selectedAudioOutputDevice: M,
71
- changeDevice: b,
72
- changeAudioOutputDevice: k
73
- };
74
- };
75
- export {
76
- E as default
77
- };
78
- //# sourceMappingURL=use-media-devices.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-media-devices.js","sources":["../../../../../src/features/av/av-preview/hooks/use-media-devices.ts"],"sourcesContent":["import { useMediaManager } from '@cuemath/av';\nimport {\n type IDevicesMap,\n type TDeviceError,\n type TDisplayDeviceError,\n} from '@cuemath/av/dist/types';\nimport type { RefObject } from 'react';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport type { ILogger, TMediaKind } from '../av-preview-types';\n\ninterface IChangeDevice {\n (deviceId: string | undefined, kind: TMediaKind): void;\n}\n\ninterface IUseMediaDevices {\n (\n videoElRef: RefObject<HTMLVideoElement | null>,\n logger: ILogger,\n ): {\n audioDeviceError?: TDeviceError;\n videoDeviceError?: TDeviceError;\n devices: IDevicesMap;\n selectedAudioDevice?: string;\n selectedVideoDevice?: string;\n selectedAudioOutputDevice?: string;\n changeDevice: IChangeDevice;\n changeAudioOutputDevice: (deviceId: string) => void;\n };\n}\n\nconst useMediaDevices: IUseMediaDevices = (videoElRef, logger) => {\n const [audioDeviceError, setAudioDeviceError] = useState<TDeviceError>();\n const [videoDeviceError, setVideoDeviceError] = useState<TDeviceError>();\n const [selectedAudioDevice, setAudioDevice] = useState<string>();\n const [selectedVideoDevice, setVideoDevice] = useState<string>();\n const [devices, setDevices] = useState<IDevicesMap>({\n audio: [],\n video: [],\n audioOutput: [],\n });\n const [selectedAudioOutputDevice, setSelectedAudioOutputDevice] = useState<string>();\n\n const mediaManager = useMediaManager();\n\n const onError = useCallback(\n (\n error: TDeviceError | TDisplayDeviceError | undefined,\n type: 'camera' | 'microphone' | 'screen',\n ) => {\n logger('av_preview_error', { error });\n if (type === 'microphone') {\n setAudioDeviceError(error as TDeviceError);\n } else if (type === 'camera') {\n setVideoDeviceError(error as TDeviceError);\n }\n },\n [logger],\n );\n const getAndUpdateSelectedDevices = useCallback(() => {\n const { audioDeviceId, videoDeviceId } = mediaManager.getSelectedDeviceDetails();\n\n setAudioDevice(audioDeviceId);\n setVideoDevice(videoDeviceId);\n }, [mediaManager]);\n\n const updateAvailableDevices = useCallback(\n (updatedDevices?: IDevicesMap) => {\n if (updatedDevices) {\n setDevices(updatedDevices);\n } else {\n setDevices(mediaManager.getAvailableDevices());\n }\n getAndUpdateSelectedDevices();\n },\n [getAndUpdateSelectedDevices, mediaManager],\n );\n\n useEffect(() => {\n mediaManager.addDevicesChangeListener(updateAvailableDevices);\n\n return () => {\n mediaManager.addDevicesChangeListener(undefined);\n };\n }, [mediaManager, updateAvailableDevices]);\n\n useEffect(() => {\n if (!audioDeviceError && !videoDeviceError && videoElRef.current) {\n }\n });\n\n useEffect(() => {\n async function getStreamFromMediaManager() {\n if (!audioDeviceError || !videoDeviceError) {\n const stream = await mediaManager.initializeUserMedia({\n onError,\n constraints: { audio: true, video: true },\n });\n\n updateAvailableDevices();\n\n if (videoElRef.current && stream) {\n videoElRef.current.srcObject = stream;\n }\n }\n }\n getStreamFromMediaManager();\n }, [\n audioDeviceError,\n mediaManager,\n onError,\n updateAvailableDevices,\n videoDeviceError,\n videoElRef,\n ]);\n\n const changeDevice = useCallback<IChangeDevice>(\n async (deviceId, deviceKind) => {\n if (!mediaManager || !deviceId) return;\n\n mediaManager.changeSelectedDevice(deviceId, deviceKind);\n if (deviceKind === 'video') {\n setVideoDevice(deviceId);\n } else if (deviceKind === 'audio') {\n setAudioDevice(deviceId);\n }\n },\n [mediaManager],\n );\n\n const changeAudioOutputDevice = useCallback(\n (deviceId: string) => {\n mediaManager.setAudioOutputDevice(deviceId);\n\n setSelectedAudioOutputDevice(deviceId);\n const videoEl = videoElRef.current;\n\n if (videoEl && 'setSinkId' in videoEl) {\n videoEl.setSinkId(deviceId).catch(error => {\n logger('av_preview_set_audio_output_device_error', {\n deviceId,\n error_name: error?.name,\n error_message: error?.message,\n });\n });\n }\n },\n [videoElRef, mediaManager, logger],\n );\n\n return {\n audioDeviceError,\n videoDeviceError,\n devices,\n selectedVideoDevice,\n selectedAudioDevice,\n selectedAudioOutputDevice,\n changeDevice,\n changeAudioOutputDevice,\n };\n};\n\nexport default useMediaDevices;\n"],"names":["useMediaDevices","videoElRef","logger","audioDeviceError","setAudioDeviceError","useState","videoDeviceError","setVideoDeviceError","selectedAudioDevice","setAudioDevice","selectedVideoDevice","setVideoDevice","devices","setDevices","selectedAudioOutputDevice","setSelectedAudioOutputDevice","mediaManager","useMediaManager","onError","useCallback","error","type","getAndUpdateSelectedDevices","audioDeviceId","videoDeviceId","updateAvailableDevices","updatedDevices","useEffect","getStreamFromMediaManager","stream","changeDevice","deviceId","deviceKind","changeAudioOutputDevice","videoEl"],"mappings":";;AA+BM,MAAAA,IAAoC,CAACC,GAAYC,MAAW;AAChE,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAAuB,GACjE,CAACC,GAAkBC,CAAmB,IAAIF,EAAuB,GACjE,CAACG,GAAqBC,CAAc,IAAIJ,EAAiB,GACzD,CAACK,GAAqBC,CAAc,IAAIN,EAAiB,GACzD,CAACO,GAASC,CAAU,IAAIR,EAAsB;AAAA,IAClD,OAAO,CAAC;AAAA,IACR,OAAO,CAAC;AAAA,IACR,aAAa,CAAC;AAAA,EAAA,CACf,GACK,CAACS,GAA2BC,CAA4B,IAAIV,EAAiB,GAE7EW,IAAeC,KAEfC,IAAUC;AAAA,IACd,CACEC,GACAC,MACG;AACI,MAAAnB,EAAA,oBAAoB,EAAE,OAAAkB,EAAA,CAAO,GAChCC,MAAS,eACXjB,EAAoBgB,CAAqB,IAChCC,MAAS,YAClBd,EAAoBa,CAAqB;AAAA,IAE7C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