dmed-voice-assistant 1.2.15 → 1.2.17

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.
@@ -118,7 +118,7 @@ const RecordListItem = _ref => {
118
118
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
119
119
  className: "flex items-center justify-between",
120
120
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
121
- className: "flex items-center space-x-2",
121
+ className: "grid grid-cols-[auto_180px_auto] flex items-center space-x-2",
122
122
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
123
123
  className: "cursor-pointer",
124
124
  onClick: playAudio,
@@ -181,36 +181,41 @@ const RecordListItem = _ref => {
181
181
  }), formatBytes(capacity).type]
182
182
  })]
183
183
  })]
184
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
185
- className: "!font-[600] !text-[20px]",
186
- color: "#EAE5DC",
187
- sx: {
188
- fontFamily: "Afacad !important"
184
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
185
+ style: {
186
+ textAlign: "right"
189
187
  },
190
- children: [formatTime(time).minutes, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
191
- ref: el => {
192
- if (el) {
193
- el.style.setProperty('font-family', 'Afacad', 'important');
194
- }
195
- },
196
- style: {
197
- fontWeight: "400",
198
- fontSize: "16px",
199
- marginRight: "5px"
200
- },
201
- children: "m"
202
- }), formatTime(time).seconds, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
203
- ref: el => {
204
- if (el) {
205
- el.style.setProperty('font-family', 'Afacad', 'important');
206
- }
207
- },
208
- style: {
209
- fontWeight: "400",
210
- fontSize: "16px"
188
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
189
+ className: "!font-[600] !text-[20px]",
190
+ color: "#EAE5DC",
191
+ sx: {
192
+ fontFamily: "Afacad !important"
211
193
  },
212
- children: "s"
213
- })]
194
+ children: [formatTime(time).minutes, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
195
+ ref: el => {
196
+ if (el) {
197
+ el.style.setProperty('font-family', 'Afacad', 'important');
198
+ }
199
+ },
200
+ style: {
201
+ fontWeight: "400",
202
+ fontSize: "16px",
203
+ marginRight: "5px"
204
+ },
205
+ children: "m"
206
+ }), formatTime(time).seconds, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
207
+ ref: el => {
208
+ if (el) {
209
+ el.style.setProperty('font-family', 'Afacad', 'important');
210
+ }
211
+ },
212
+ style: {
213
+ fontWeight: "400",
214
+ fontSize: "16px"
215
+ },
216
+ children: "s"
217
+ })]
218
+ })
214
219
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
215
220
  className: "cursor-pointer",
216
221
  onClick: handlePopoverOpen,
package/dist/recorder.js CHANGED
@@ -75,6 +75,7 @@ const RecorderBox = _ref => {
75
75
  };
76
76
  const initRecorder = async () => {
77
77
  try {
78
+ fetchAudioInputDevices();
78
79
  const stream = await navigator.mediaDevices.getUserMedia({
79
80
  audio: true
80
81
  });
@@ -86,6 +87,27 @@ const RecorderBox = _ref => {
86
87
  console.error("Unable to access microphone", error);
87
88
  }
88
89
  };
90
+ const fetchAudioInputDevices = async () => {
91
+ try {
92
+ // Request permission to access media devices
93
+ await navigator.mediaDevices.getUserMedia({
94
+ audio: true
95
+ });
96
+
97
+ // Enumerate all media devices
98
+ const devices = await navigator.mediaDevices.enumerateDevices();
99
+
100
+ // Filter only audio input devices
101
+ const audioInputs = devices.filter(device => device.kind === "audioinput");
102
+ let temp = ['Auto-Detect'];
103
+ audioInputs.forEach(device => {
104
+ temp.push(device.label);
105
+ });
106
+ setVoiceList(temp);
107
+ } catch (error) {
108
+ console.error("Error accessing audio devices:", error);
109
+ }
110
+ };
89
111
  const startRecording = async () => {
90
112
  if (!mediaRecorderRef.current) {
91
113
  await initRecorder();
@@ -174,30 +196,6 @@ const RecorderBox = _ref => {
174
196
  clearInterval(intervalId); // Stop the interval using the interval ID
175
197
  setIsRunning(false); // Set the counter as not running
176
198
  };
177
- (0, _react.useEffect)(() => {
178
- const fetchAudioInputDevices = async () => {
179
- try {
180
- // Request permission to access media devices
181
- await navigator.mediaDevices.getUserMedia({
182
- audio: true
183
- });
184
-
185
- // Enumerate all media devices
186
- const devices = await navigator.mediaDevices.enumerateDevices();
187
-
188
- // Filter only audio input devices
189
- const audioInputs = devices.filter(device => device.kind === "audioinput");
190
- let temp = ['Auto-Detect'];
191
- audioInputs.forEach(device => {
192
- temp.push(device.label);
193
- });
194
- setVoiceList(temp);
195
- } catch (error) {
196
- console.error("Error accessing audio devices:", error);
197
- }
198
- };
199
- fetchAudioInputDevices();
200
- }, []);
201
199
  (0, _react.useEffect)(() => {
202
200
  setRecordList([...recordHistoryList]);
203
201
  }, [recordHistoryList]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dmed-voice-assistant",
3
- "version": "1.2.15",
3
+ "version": "1.2.17",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"