From cb7e058067dbb5ada01fc757be58fd44489345f9 Mon Sep 17 00:00:00 2001 From: Iro <155815508+Iro96@users.noreply.github.com> Date: Tue, 28 Apr 2026 13:50:59 +0700 Subject: [PATCH] fix(stage-ui): correct stream reuse when switching sources + improve capture pipeline (#1744) --- .../renderer/components/WithScreenCapture.vue | 10 ++ .../composables/use-vision-screen-capture.ts | 118 ++++++++++-------- .../pages/devtools/screen-capture.vue | 19 +-- .../src/renderer/pages/devtools/vision.vue | 36 +++--- .../utils/create-object-url-from-bytes.ts | 17 +++ nix/assets-hash.txt | 2 +- .../modules/vision/orchestrator.test.ts | 12 ++ .../src/stores/modules/vision/orchestrator.ts | 113 +++++++++++------ pnpm-lock.yaml | 1 + 9 files changed, 203 insertions(+), 125 deletions(-) create mode 100644 apps/stage-tamagotchi/src/renderer/utils/create-object-url-from-bytes.ts diff --git a/apps/stage-tamagotchi/src/renderer/components/WithScreenCapture.vue b/apps/stage-tamagotchi/src/renderer/components/WithScreenCapture.vue index a053ec131..e96d2373a 100644 --- a/apps/stage-tamagotchi/src/renderer/components/WithScreenCapture.vue +++ b/apps/stage-tamagotchi/src/renderer/components/WithScreenCapture.vue @@ -12,6 +12,10 @@ const props = defineProps<{ sourcesOptions: SourcesOptions }>() +const emit = defineEmits<{ + permissionGranted: [] +}>() + const sourcesOptions = toRef(props, 'sourcesOptions') const hasPermissions = ref(false) @@ -57,6 +61,12 @@ watch(focused, async (isFocused) => { await checkPermissions() } }) + +watch(hasPermissions, (nextHasPermissions, previousHasPermissions) => { + if (nextHasPermissions && !previousHasPermissions) { + emit('permissionGranted') + } +})