From e5ba4e728ffc343a65ba2dde2892558f07263d1e Mon Sep 17 00:00:00 2001 From: Niklas Gruhn Date: Mon, 15 Jul 2024 22:20:46 +0200 Subject: [PATCH] fix: increase stream-load-timeout to 6 seconds @Asko-Dev reports that the `SteamLoadTimeoutError` seems to be thrown "randomly" on iOS 17.5.1. That suggests that there is a race condition with the timeout. Let's try to double the timeout (3s -> 6s) and see if that helps. See: #298 --- src/misc/camera.ts | 4 ++-- src/misc/errors.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/misc/camera.ts b/src/misc/camera.ts index 3d3dac7e..d8fb9aac 100644 --- a/src/misc/camera.ts +++ b/src/misc/camera.ts @@ -84,8 +84,8 @@ async function runStartTask( // streams and never emit the `loadeddata` event. Looks like this is // related to a WebKit issue (see #298). No workarounds at the moment. // To at least detect this situation, we throw an error if the event - // has not been emitted after a 3 second timeout. - timeout(3000).then(() => { + // has not been emitted after a 6 second timeout. + timeout(6_000).then(() => { throw new StreamLoadTimeoutError() }) ]) diff --git a/src/misc/errors.ts b/src/misc/errors.ts index 7f08e324..81cfd064 100644 --- a/src/misc/errors.ts +++ b/src/misc/errors.ts @@ -27,7 +27,7 @@ export class InsecureContextError extends Error { export class StreamLoadTimeoutError extends Error { constructor() { super( - 'Loading camera stream timed out after 3 seconds. If you are on iOS in PWA mode, this is a known issue (see https://github.com/gruhn/vue-qrcode-reader/issues/298)' + 'Loading camera stream timed out after 6 seconds. If you are on iOS in PWA mode, this is a known issue (see https://github.com/gruhn/vue-qrcode-reader/issues/298)' ) this.name = 'StreamLoadTimeoutError'