Repository navigation
feat(videoWindow): add VideoWindow component for video on Crestron panels - #111
Conversation
…nels Adds a single React component that shows a video stream on a TSW/TS panel or DGE, covering what ch5-video and ch5-background do in CH5: it sends the start/resize/stop requests to the panel and makes the page background see-through where the video is drawn. When the app is loaded in an iframe, requests and responses go through the parent page with postMessage (the touch panel wrapper app relays them). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018uDiZZz3jRd9CFVoYcPSJb
|
🎉 This PR is included in version 1.26.0-feat-video-window.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues can leave video windows misaligned after layout shifts, playback stopped after back/forward-cache restoration, and page backgrounds altered when root and body backgrounds require compositing.
3 open issues
What changed in this PR
Adds VideoWindow to the core React library for displaying firmware-decoded video on Crestron touch panels and DGEs, combining video control and transparent-background handling in one component.
Changes:
- Adds Network, HDMI, and DM sources with playback controls and status callbacks.
- Supports direct CrComLib communication and iframe communication through a parent-page relay.
- Introduces visibility-based playback, location updates, and background cutouts.
| File | Description |
|---|---|
src/lib/shared/VideoWindow/VideoWindow.tsx |
Adds the component, playback lifecycle, positioning, and status handling. |
src/lib/shared/VideoWindow/VideoWindow.module.scss |
Defines black fallback and transparent playback backgrounds. |
src/lib/shared/VideoWindow/videoTransport.ts |
Handles direct panel communication and iframe relay messaging. |
src/lib/shared/VideoWindow/videoStatusMessages.ts |
Maps panel status codes to readable messages. |
src/lib/shared/VideoWindow/videoBackdrop.ts |
Manages page backgrounds and clips video cutouts. |
src/lib/shared/VideoWindow/index.ts |
Exports the component, types, and status messages. |
src/lib/shared/index.ts |
Exposes VideoWindow through the shared library exports. |
Review effort: Balanced
- restart the video when the page is restored from the back/forward cache - check the position of a running video every 250 ms, so a layout shift with no resize or scroll event still moves the video and the hole - copy both the html and body backgrounds onto the backdrop as two layers - tell the parent page which colour scheme the app uses, so the wrapper can match it on the iframe Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018uDiZZz3jRd9CFVoYcPSJb
|
🎉 This PR is included in version 1.26.0-feat-video-window.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.26.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |

Summary
Adds
VideoWindow, a single React component that shows a video stream on a Crestron touch panel (TSW, TS) or DGE. It does the job thatch5-videoandch5-backgrounddo together in Crestron's CH5 component library.What changed and why
The browser on a panel does not decode video. The panel firmware decodes it and draws it on a layer underneath the web page, so the page has to be see-through where the video sits.
VideoWindow.tsxsends the sameCsig.video.requeststart, resize and stop messages asch5-videoand readsCsig.video.responsefor status. It only runs the video while the window is at least 98% on screen (the CH5 threshold), re-sends the location when the element moves or resizes, and stops the video on unmount and onpagehide.videoBackdrop.tsreplacesch5-background. While a video is running it copies the<html>/<body>background onto a fixed layer behind the page, makes<html>and<body>transparent, and clips a hole in that layer over each video. Everything is restored when the last video stops.videoTransport.tscovers the app being loaded in an iframe by the touch panel wrapper app. In that case requests and responses go through the parent page withpostMessage, because the panel only talks to the top-level page and only the parent knows where the iframe is on screen. Loaded directly on the panel, the component talks to CrComLib as before. The other half is in PepperDash/mobile-control-touchpanel-wrapper-app (branchfeat/video-relay).unsupportedand a black box is shown.Left out compared with
ch5-video: snapshot images, the fullscreen button, multi-source selection by join, and the send-event joins.Testing
npm run lintandnpm run buildpass.JSInterfacestubbed), both loaded directly and inside the built wrapper app's iframe: start request has the right location, a simulatedstartedresponse opens the hole and restores it on error, a background colour set inline on<body>survives a start/stop cycle,pagehidesends a stop.Notes for reviewers
<body>and the component with its own solid background will cover the video.alphaBlend={false}asks the panel to draw the video over the page instead, which hides children."null"(a page loaded from a file), requests, including the stream user name and password, are posted with a wildcard target because"null"cannot be used as one. They still only go towindow.parent. Worth confirming what origin the wrapper has on a real panel.pagehideand restarts it if the wrapper resets it (a reload could leave a video running); backgrounds are made transparent with an attribute and a style rule instead of inline styles (an inlinebackground-colorwas being wiped on restore); two comments were corrected.🤖 Generated with Claude Code
https://claude.ai/code/session_018uDiZZz3jRd9CFVoYcPSJb