@incodetech/core 2.0.0-alpha.3 → 2.0.0-alpha.5

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,4 +1,4 @@
1
- import { h as stopCameraStream, m as requestCameraAccess, p as queryCameraPermission } from "./endpoints-D_pUMaqA.esm.js";
1
+ import { h as stopCameraStream, m as requestCameraAccess, p as queryCameraPermission } from "./endpoints-Dn1t57hJ.esm.js";
2
2
 
3
3
  //#region ../infra/src/device/getBrowser.ts
4
4
  function getUserAgent() {
package/dist/phone.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Manager } from "./Manager-6BwbaI_H.js";
1
+ import { t as Manager } from "./Manager-BGfxEmyv.js";
2
2
 
3
3
  //#region src/phone/types.d.ts
4
4
 
package/dist/phone.esm.js CHANGED
@@ -1,6 +1,6 @@
1
- import { g as createManager, n as api, t as endpoints } from "./endpoints-D_pUMaqA.esm.js";
1
+ import { g as createManager, n as api, t as endpoints } from "./endpoints-Dn1t57hJ.esm.js";
2
2
  import { a as createActor, i as fromPromise, n as assign, r as fromCallback, t as setup } from "./xstate.esm-B_rda9yU.esm.js";
3
- import { t as addEvent } from "./addEvent-1Mi5CEiq.esm.js";
3
+ import { t as addEvent } from "./addEvent-9v4w5iO-.esm.js";
4
4
 
5
5
  //#region src/phone/phoneServices.ts
6
6
  async function fetchPhone(signal) {
package/dist/selfie.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { t as WasmPipeline } from "./warmup-Dr7OcFND.js";
2
- import { t as Manager } from "./Manager-6BwbaI_H.js";
3
- import { n as StateMachine, t as AnyStateMachine } from "./StateMachine-7c1gcu94.js";
4
- import { n as PermissionStatus, t as PermissionResult } from "./types-tq1ypYSL.js";
1
+ import { t as WasmPipeline } from "./warmup-CEJTfxQr.js";
2
+ import { t as Manager } from "./Manager-BGfxEmyv.js";
3
+ import { n as StateMachine, t as AnyStateMachine } from "./StateMachine-DRE1oH2B.js";
4
+ import { n as PermissionStatus, t as PermissionResult } from "./types-kWlqshfM.js";
5
5
 
6
6
  //#region ../infra/src/media/canvas.d.ts
7
7
  /**
@@ -564,6 +564,7 @@ type SelfieContext = {
564
564
  faceCoordinates: FaceCoordinates | undefined;
565
565
  uploadResponse: SendFaceImageResponse | undefined;
566
566
  recordingSession: RecordingSession | undefined;
567
+ recordingStream: MediaStream | undefined;
567
568
  attemptsRemaining: number;
568
569
  uploadError: FaceErrorCode | undefined;
569
570
  permissionResult: PermissionResult | 'refresh' | undefined;
@@ -1,7 +1,7 @@
1
- import { n as requestPermission, r as getDeviceClass, t as checkPermission } from "./permissionServices-CVR0Pq38.esm.js";
2
- import { c as FaceDetectionProvider, d as StreamCanvasProcessingSession, f as StreamCanvasCapture, g as createManager, h as stopCameraStream, m as requestCameraAccess, n as api, s as WasmUtilProvider, t as endpoints, u as OpenViduRecordingProvider } from "./endpoints-D_pUMaqA.esm.js";
1
+ import { n as requestPermission, r as getDeviceClass, t as checkPermission } from "./permissionServices-CCpxd8le.esm.js";
2
+ import { c as FaceDetectionProvider, d as StreamCanvasProcessingSession, f as StreamCanvasCapture, g as createManager, h as stopCameraStream, m as requestCameraAccess, n as api, s as WasmUtilProvider, t as endpoints, u as OpenViduRecordingProvider } from "./endpoints-Dn1t57hJ.esm.js";
3
3
  import { a as createActor, i as fromPromise, n as assign, r as fromCallback, t as setup } from "./xstate.esm-B_rda9yU.esm.js";
4
- import { t as addEvent } from "./addEvent-1Mi5CEiq.esm.js";
4
+ import { t as addEvent } from "./addEvent-9v4w5iO-.esm.js";
5
5
 
6
6
  //#region src/selfie/types.ts
7
7
  const FACE_ERROR_CODES = {
@@ -152,7 +152,10 @@ async function initializeCamera(config) {
152
152
  occlusion: false
153
153
  });
154
154
  return {
155
- stream: await requestCameraAccess({ video: CAMERA_CONSTRAINTS.video }),
155
+ stream: await requestCameraAccess({
156
+ video: CAMERA_CONSTRAINTS.video,
157
+ audio: false
158
+ }),
156
159
  provider
157
160
  };
158
161
  }
@@ -249,7 +252,7 @@ async function startRecordingSession(params) {
249
252
  if (params.config.enableFaceRecording !== true) return;
250
253
  if (params.existing) return params.existing;
251
254
  const provider = params.config.recording?.capability ?? new OpenViduRecordingProvider();
252
- const clonedStream = params.stream.clone();
255
+ const clonedStream = params.clonedStream;
253
256
  const hasAudio = clonedStream.getAudioTracks().length > 0;
254
257
  const resolution = buildResolutionFromStream(clonedStream);
255
258
  const session = await createRecordingSession("selfie");
@@ -427,10 +430,10 @@ const _selfieMachine = setup({
427
430
  });
428
431
  }),
429
432
  startRecording: fromPromise(async ({ input }) => {
430
- if (!input.stream) return;
433
+ if (!input.clonedStream) return;
431
434
  return startRecordingSession({
432
435
  config: input.config,
433
- stream: input.stream,
436
+ clonedStream: input.clonedStream,
434
437
  existing: input.existing
435
438
  });
436
439
  })
@@ -477,6 +480,7 @@ const _selfieMachine = setup({
477
480
  faceCoordinates: void 0,
478
481
  uploadResponse: void 0,
479
482
  recordingSession: void 0,
483
+ recordingStream: void 0,
480
484
  attemptsRemaining: context.config.captureAttempts,
481
485
  uploadError: void 0,
482
486
  permissionResult: void 0,
@@ -505,7 +509,18 @@ const _selfieMachine = setup({
505
509
  stopMediaRecording: ({ context }) => {
506
510
  if (context.recordingSession) stopRecording(context.recordingSession);
507
511
  },
508
- clearRecordingSession: assign({ recordingSession: () => void 0 })
512
+ clearRecordingSession: assign({
513
+ recordingSession: () => void 0,
514
+ recordingStream: () => void 0
515
+ }),
516
+ createRecordingStream: assign({ recordingStream: ({ context }) => {
517
+ if (!context.config.enableFaceRecording) return;
518
+ if (context.recordingStream) return context.recordingStream;
519
+ return context.stream?.clone();
520
+ } }),
521
+ stopRecordingStream: ({ context }) => {
522
+ if (context.recordingStream) stopStream(context.recordingStream);
523
+ }
509
524
  },
510
525
  guards: {
511
526
  hasShowTutorial: ({ context }) => context.config.showTutorial,
@@ -543,6 +558,7 @@ const _selfieMachine = setup({
543
558
  faceCoordinates: void 0,
544
559
  uploadResponse: void 0,
545
560
  recordingSession: void 0,
561
+ recordingStream: void 0,
546
562
  attemptsRemaining: input.config.captureAttempts,
547
563
  uploadError: void 0,
548
564
  permissionResult: void 0,
@@ -694,6 +710,7 @@ const _selfieMachine = setup({
694
710
  initial: "checkingStream",
695
711
  exit: [
696
712
  "stopMediaRecording",
713
+ "stopRecordingStream",
697
714
  "clearRecordingSession",
698
715
  "stopMediaStream"
699
716
  ],
@@ -720,13 +737,13 @@ const _selfieMachine = setup({
720
737
  }]
721
738
  } },
722
739
  detecting: {
723
- entry: [assign({ detectionStatus: () => "detecting" })],
740
+ entry: [assign({ detectionStatus: () => "detecting" }), "createRecordingStream"],
724
741
  invoke: [{
725
742
  id: "startRecording",
726
743
  src: "startRecording",
727
744
  input: ({ context }) => ({
728
745
  config: context.config,
729
- stream: context.stream,
746
+ clonedStream: context.recordingStream,
730
747
  existing: context.recordingSession
731
748
  }),
732
749
  onDone: { actions: assign({ recordingSession: ({ context, event }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/core",
3
- "version": "2.0.0-alpha.3",
3
+ "version": "2.0.0-alpha.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",