Skip to content

feat(webcams): add iframe-based webcam service option#2384

Merged
meteyou merged 7 commits intomainsail-crew:developfrom
justinh-rahb:codex/add-webpage-camera-type-to-mainsail
Jan 10, 2026
Merged

feat(webcams): add iframe-based webcam service option#2384
meteyou merged 7 commits intomainsail-crew:developfrom
justinh-rahb:codex/add-webpage-camera-type-to-mainsail

Conversation

@justinh-rahb
Copy link
Contributor

@justinh-rahb justinh-rahb commented Jan 9, 2026

Description

This PR adds an optional iframe-based webcam service that allows embedding arbitrary webpages as webcam tiles.

Mainsail currently assumes webcams are video streams (MJPEG/WebRTC). This works well for traditional cameras, but makes it impossible to display non-video visual sources that are exposed as webpages.

The iframe service is fully opt-in, isolated from existing webcam implementations, and easy to ignore for setups that don’t need it.

Concrete use case

On Snapmaker U1 (Extended community firmware), the printer exposes a live, interactive view of its integrated touchscreen as a webpage rather than a video stream.

With iframe webcam support:

  • A print is sent from Orca
  • Orca switches to the Device tab
  • The printer's screen UI is embedded directly in Mainsail
  • Spool and print options can be confirmed immediately
  • No Snapmaker Orca Device tab or mobile app is required

A short recording demonstrating this workflow is included below.

What’s included

  • New iframe-based webcam streamer integrated into existing lazy-loading and rendering logic
  • New Webpage (iframe) webcam service option in settings
  • Aspect-ratio–based responsive sizing with validation and inline guidance
  • Default aspect ratio of 16:9 for new iframe webcams
  • Updated webcam type definitions to include iframe configuration
  • English locale strings for iframe-specific labels and validation feedback

Scope

  • Fully opt-in via a new webcam service type
  • No changes to existing webcam behavior
  • No assumptions about the embedded page (static or interactive)
  • Intended to be ignored by users who only use traditional webcams

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings

Screen.Recording.2026-01-09.at.10.26.39.AM.mp4

Signed-off-by: Codex <codex@openai.com>
@meteyou
Copy link
Member

meteyou commented Jan 9, 2026

This is exactly the Webcam mode which I don't want to implement, because it could be "miss used" like that...

I will review the code and see if there are some "downsides" of it.

@justinh-rahb
Copy link
Contributor Author

Totally fair — I understand the concern.

All I can really ask is that you consider it on its technical merits. It’s fully opt-in, isolated, and doesn’t affect existing webcam behavior.

For me it solves a real use case right now, and keeping it upstream would avoid having to maintain a long-term patch or fork for something that’s otherwise generic and self-contained.

Happy to tighten or constrain it if you spot concrete downsides during review.

… client

Signed-off-by: Stefan Dej <meteyou@gmail.com>
…y 100% width

Signed-off-by: Stefan Dej <meteyou@gmail.com>
… fallback aspect-ratio

Signed-off-by: Stefan Dej <meteyou@gmail.com>
Signed-off-by: Stefan Dej <meteyou@gmail.com>
@meteyou
Copy link
Member

meteyou commented Jan 10, 2026

@justinh-rahb pls enable "Allow edits by maintainers" in the sidebar. I just fixed the rotation and make the aspectRatio more generic, because I should add this also for other streamers.

@justinh-rahb
Copy link
Contributor Author

@meteyou just enabled it. thanks for taking a look and for the improvements.

Happy to help or adjust anything else as needed.

@meteyou
Copy link
Member

meteyou commented Jan 10, 2026

@justinh-rahb thx! i pushed my changed. pls double check it again, then i will merge it.

@justinh-rahb
Copy link
Contributor Author

@meteyou looks good to me 👍
I’m spinning up a test build on my U1 right now and will report back shortly.

Signed-off-by: Stefan Dej <meteyou@gmail.com>
@meteyou
Copy link
Member

meteyou commented Jan 10, 2026

@justinh-rahb did you disabled the option to push commits again?

I just would like to push a small fix for the aspect ratio validation.

@justinh-rahb
Copy link
Contributor Author

justinh-rahb commented Jan 10, 2026

@justinh-rahb did you disabled the option to push commits again?

I just would like to push a small fix for the aspect ratio validation.

Sorry, yes I had a secret I needed to push the test. I've removed it and re-enabled now. The test build works!

Screenshot 2026-01-10 at 1 43 27 PM

Signed-off-by: Stefan Dej <meteyou@gmail.com>
@meteyou meteyou merged commit 7b54653 into mainsail-crew:develop Jan 10, 2026
5 checks passed
@meteyou
Copy link
Member

meteyou commented Jan 10, 2026

@justinh-rahb thx for your contribution!

@justinh-rahb
Copy link
Contributor Author

Thanks for the quick review and for working through this with me, I really appreciate the consideration and the improvements you made.

There’s a small group of us working on U1 tooling and frontend integration, and while iframe is an imperfect solution today, it’s a meaningful first step toward relying exclusively on mainline Orca without vendor-specific forks or apps.

Thanks again for taking the time 🙏

@justinh-rahb justinh-rahb deleted the codex/add-webpage-camera-type-to-mainsail branch January 10, 2026 23:10
@justinh-rahb
Copy link
Contributor Author

I've taken the liberty of preparing a small addition to the docs to address this change: mainsail-crew/gb-docs#23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants