Skip to content

Commit

Permalink
fix: increase stream-load-timeout to 6 seconds
Browse files Browse the repository at this point in the history
@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
  • Loading branch information
gruhn committed Jul 15, 2024
1 parent 56da209 commit e5ba4e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/misc/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
])
Expand Down
2 changes: 1 addition & 1 deletion src/misc/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit e5ba4e7

Please sign in to comment.