@edifice.io/react 2.3.1-develop.20250917175806 → 2.3.1-develop.20250918154957

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.
@@ -47,7 +47,7 @@ const VideoRecorder = /* @__PURE__ */ forwardRef(({
47
47
  }
48
48
  useEffect(() => {
49
49
  try {
50
- videoRef.current && (videoRef.current.src && (window.URL.revokeObjectURL(videoRef.current.src), videoRef.current.src = ""), stream && (videoRef.current.srcObject = stream, videoRef.current.autoplay = !0, videoRef.current.volume = 1, videoRef.current.muted = !0));
50
+ videoRef.current && (videoRef.current.src && (window.URL.revokeObjectURL(videoRef.current.src), videoRef.current.src = ""), videoRef.current.srcObject instanceof MediaStream && (videoRef.current.srcObject = null), stream && (videoRef.current.srcObject = stream, videoRef.current.autoplay = !0, videoRef.current.volume = 1, videoRef.current.muted = !0, videoRef.current.load()));
51
51
  } catch (err) {
52
52
  console.error(err);
53
53
  }
@@ -113,11 +113,11 @@ const VideoRecorder = /* @__PURE__ */ forwardRef(({
113
113
  onError("Error while uploading video"), setSaving(!1), setSaved(!0);
114
114
  }, handleEnded = () => {
115
115
  setPlaying(!1), setPlayedTime(0), videoRef.current && (videoRef.current.currentTime = 0);
116
- }, handleInputDeviceChange = useCallback((option) => {
116
+ }, handleInputDeviceChange = (option) => {
117
117
  var _a;
118
118
  const selectedDevice = inputDevices.find((inputDevice) => inputDevice.label === option);
119
119
  ((_a = recorderRef.current) == null ? void 0 : _a.state) === "recording" && (recorderRef.current.requestData(), recorderRef.current.stop()), setPreferedDevice(selectedDevice);
120
- }, [inputDevices, stream]);
120
+ };
121
121
  return useEffect(() => {
122
122
  recordedTime >= maxDuration && handleStop();
123
123
  }, [recordedTime, handleStop]), /* @__PURE__ */ jsxs("div", { className: "video-recorder d-flex flex-fill flex-column align-items-center pb-8", children: [
@@ -9,41 +9,41 @@ function useCameras() {
9
9
  t
10
10
  } = useTranslation(), [inputDevices, setInputDevices] = useState([]), [mediaStreamConstraints, setMediaStreamConstraints] = useState({
11
11
  audio: !0,
12
- video: {
13
- facingMode: "environment",
14
- aspectRatio: VIDEO_WIDTH / VIDEO_HEIGHT
15
- }
12
+ video: !0
16
13
  }), [stream, setStream] = useState();
17
14
  async function getVideoInputDevices() {
18
15
  return (await navigator.mediaDevices.enumerateDevices()).filter((device2) => device2.kind === "videoinput");
19
16
  }
20
- async function enableStream(mediaStreamConstraints2) {
17
+ const enableStream = async (constraints) => {
21
18
  try {
22
- const mediaStream = await navigator.mediaDevices.getUserMedia(mediaStreamConstraints2);
23
- setStream((previousStream) => (previousStream == null || previousStream.getTracks().forEach((track) => track.stop()), mediaStream));
19
+ const mediaStream = await navigator.mediaDevices.getUserMedia(constraints);
20
+ setStream(mediaStream);
24
21
  } catch (err) {
25
22
  console.error(err);
26
23
  }
27
- }
28
- const restartStream = () => {
29
- enableStream(mediaStreamConstraints);
24
+ }, restartStream = () => {
25
+ stream == null || stream.getTracks().forEach((track) => track.stop()), enableStream(mediaStreamConstraints);
30
26
  }, setPreferedDevice = (device2) => {
31
- let mediaStreamConstraints2 = {};
32
- device2 != null && device2.deviceId ? ((device2 == null ? void 0 : device2.deviceId) === "environment" || (device2 == null ? void 0 : device2.deviceId) === "user" ? mediaStreamConstraints2 = {
27
+ let constraints = {};
28
+ device2 != null && device2.deviceId ? (device2.deviceId === "environment" || device2.deviceId === "user" ? constraints = {
33
29
  audio: !0,
34
30
  video: {
35
31
  aspectRatio: VIDEO_WIDTH / VIDEO_HEIGHT,
36
32
  facingMode: device2 == null ? void 0 : device2.deviceId
37
33
  }
38
- } : mediaStreamConstraints2 = {
34
+ } : constraints = {
39
35
  audio: !0,
40
36
  video: {
41
37
  aspectRatio: VIDEO_WIDTH / VIDEO_HEIGHT,
42
- deviceId: device2.deviceId
38
+ deviceId: {
39
+ exact: device2.deviceId
40
+ }
43
41
  }
44
- }, setMediaStreamConstraints(mediaStreamConstraints2), restartStream()) : console.error("Selected input device id is null");
42
+ }, setMediaStreamConstraints(constraints)) : console.error("Selected input device id is null");
45
43
  };
46
44
  return useEffect(() => {
45
+ restartStream();
46
+ }, [mediaStreamConstraints]), useEffect(() => {
47
47
  async function initInputDevices() {
48
48
  await enableStream(mediaStreamConstraints);
49
49
  const videoDevices = await getVideoInputDevices();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.3.1-develop.20250917175806",
3
+ "version": "2.3.1-develop.20250918154957",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -130,9 +130,9 @@
130
130
  "react-slugify": "^3.0.3",
131
131
  "swiper": "^10.1.0",
132
132
  "ua-parser-js": "^1.0.36",
133
- "@edifice.io/bootstrap": "2.3.1-develop.20250917175806",
134
- "@edifice.io/tiptap-extensions": "2.3.1-develop.20250917175806",
135
- "@edifice.io/utilities": "2.3.1-develop.20250917175806"
133
+ "@edifice.io/tiptap-extensions": "2.3.1-develop.20250918154957",
134
+ "@edifice.io/utilities": "2.3.1-develop.20250918154957",
135
+ "@edifice.io/bootstrap": "2.3.1-develop.20250918154957"
136
136
  },
137
137
  "devDependencies": {
138
138
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -163,8 +163,8 @@
163
163
  "vite": "^5.4.11",
164
164
  "vite-plugin-dts": "^4.1.0",
165
165
  "vite-tsconfig-paths": "^5.0.1",
166
- "@edifice.io/client": "2.3.1-develop.20250917175806",
167
- "@edifice.io/config": "2.3.1-develop.20250917175806"
166
+ "@edifice.io/client": "2.3.1-develop.20250918154957",
167
+ "@edifice.io/config": "2.3.1-develop.20250918154957"
168
168
  },
169
169
  "peerDependencies": {
170
170
  "@react-spring/web": "^9.7.5",