Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Show more detailed error for webcam load failures #5011

Closed
cp2004 opened this issue May 7, 2024 · 3 comments
Closed

[Request] Show more detailed error for webcam load failures #5011

cp2004 opened this issue May 7, 2024 · 3 comments
Labels
done Done but not yet released not technically possible Issue is technically impossible to solve/implement request Feature request
Milestone

Comments

@cp2004
Copy link
Member

cp2004 commented May 7, 2024

Is your feature request related to a problem? Please describe.

When a webcam fails to load, OctoPrint shows a message "Webcam stream not loaded". There are many causes of webcam streams not loading in the browser, but to users that are not technically inclined they see this as the error message, but don't understand what it means. This results in posts on the forums/discord server titled "Webcam stream not loaded", with very little supporting information, people jumping on other forum threads with "the same issue" when in fact it is completely different. There is no detail for users who want to troubleshoot themselves to start searching the forums with, so we also find people trying to solve their problem with a whole range of fixes (sometimes making things worse) because they can't tell which one is relevant to their problem.

In the case of CORS issues for example, the error message in the browser clearly explains that it is a CORS problem rather than something different.

Describe the solution you'd like

Provide more information about the reason the stream has failed to load. I would probably put this hidden behind a "more information" clickable thing to avoid cluttering up the screen with irrelevant error messages (maybe they've just unplugged their camera, and it normally works - and don't want to see red error popups for example).

Describe alternatives you've considered

Capturing the browser console as part of the systeminfo bundle. While this would contain the information that I'm after when people post on the forums, it doesn't allow people to troubleshoot/search for help themselves, as they are not likely to look in the systeminfo bundle if they weren't likely to look at the browser console.

Additional context

https://community.octoprint.org/search?q=webcam%20stream%20not%20loaded

@github-actions github-actions bot added the request Feature request label May 7, 2024
@foosel foosel added this to the 1.11.0 milestone May 16, 2024
@foosel foosel added the determine feasibility Not yet clear whether this can be implemented at all label May 21, 2024
@foosel
Copy link
Member

foosel commented May 21, 2024

Phew, tbh, this could become really really tricky to pull off. I looked into what kind of information I can get from the data data I get on a loading error and it looks quite bad. And a quick search revealed that there's apparently no way at all to even get information on CORS errors from the JS client side. So I'm really not sure if anything can be done here, but I'll take another timeboxed poke at this.

@foosel foosel added not technically possible Issue is technically impossible to solve/implement and removed determine feasibility Not yet clear whether this can be implemented at all labels May 22, 2024
@foosel
Copy link
Member

foosel commented May 22, 2024

Yeah, that's not going to happen. There's simply no way to get any kind of further information on the error that caused the failure to load.

In case of an image (e.g. mjpg stream), so an HTMLImageElement, all we have is the error event, which is pretty damn useless: HTMLElement: error event. The only information we get in there is "type": "error" and that's it, it's a generic event. So we know "something failed" but that's it.

And a video embed, so an HTMLMediaElement, is in the exact same situation: all we get is a generic error Event without any additional information on the reason.

As to CORS errors specifically, there's a thread on that on Sentry's repo: getsentry/sentry-javascript#8342. tldr: Impossible, security restrictions prevent any kind of programmatic access to CORS errors.

And even attempting to capture the browser console here won't work - the error happens completely outside of what's possible to access from JavaScript, overriding console.error or window.onerror doesn't help at all.

@foosel foosel closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
@github-actions github-actions bot added the done Done but not yet released label May 22, 2024
@cp2004
Copy link
Member Author

cp2004 commented May 22, 2024

Thanks for giving it a look! It does make some sense I guess that you can't get info about the errors like that, for security. At least we tried.

One final thought I did have was to provide a link to click that would open the browser error console so the user can find the error easier. This might not be possible either, so I will have a look and see if I can find anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done Done but not yet released not technically possible Issue is technically impossible to solve/implement request Feature request
Projects
Status: Done
Development

No branches or pull requests

2 participants