Fix HDHomeRun preview: GET fallback when HEAD not supported by device#112
Fix HDHomeRun preview: GET fallback when HEAD not supported by device#112
Conversation
HDHomeRun devices do not implement HEAD on their stream endpoints. The server's HEAD handler issues axios.head() to the upstream and returns 502 on failure, causing probeResponse.ok to be false and the .catch() to fire — silently doing nothing, so HLS.js runs, downloads ~1MB of MPEG-TS, and mpegts.js fails silently on MPEG-2. When HEAD fails, now issue a GET probe and cancel the body immediately after reading the Content-Type header. If the content type confirms MPEG-TS, the active players are torn down and the unsupported-codec error overlay is shown. The staleness guard prevents the callback from firing on a stale result after the user has switched channels. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates the Admin “Preview” video player logic to better detect HDHomeRun stream endpoints that don’t support HEAD, so the UI can reliably show the unsupported-codec overlay instead of leaving the user with a black screen.
Changes:
- Adds a GET-based probe fallback when the existing
HEADprobe fails for HDHomeRun preview streams. - Cancels the GET response body after reading headers and, if MPEG-TS is detected, tears down active players and shows the unsupported-codec error (with a staleness guard).
admin/src/App.vue
Outdated
| if (hlsInstance) { | ||
| hlsInstance.destroy(); | ||
| hlsInstance = null; | ||
| } | ||
| if (mpegtsInstance) { | ||
| mpegtsInstance.destroy(); | ||
| mpegtsInstance = null; | ||
| } | ||
|
|
||
| video.removeAttribute('src'); | ||
| video.load(); | ||
| showPlayerError(ERR_UNSUPPORTED_CODEC); |
There was a problem hiding this comment.
The destroy/reset/error sequence is duplicated in both the successful HEAD probe path and the GET fallback path. Consider extracting a small helper (e.g., “tearDownPlayersAndShowUnsupportedCodec(video)”) to keep these paths in sync and reduce future maintenance risk.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…down The destroy/reset/showPlayerError sequence was identical in both the HEAD probe path and the GET fallback path. Extract it into a shared helper so the two paths stay in sync and the staleness guard is only written once. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@cbulock Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
2 similar comments
|
@cbulock Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
|
@cbulock Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
Summary
axios.head()to the upstream; on failure it returns 502, causingprobeResponse.okto be false and the.catch()to fire silently — so HLS.js still runs, downloads ~1MB of MPEG-TS, and mpegts.js fails silently on MPEG-2 video (no error event emitted)Content-Typeheader; if MPEG-TS is confirmed, tear down any active players and show the unsupported-codec error overlayHow it works
The existing parallel probe structure is preserved — HEAD fires alongside HLS.js with no added latency. If HEAD succeeds (device supports it), it works as before. If HEAD fails, the
.catch()now issues a GET probe, reads just the headers, cancels the body, and interrupts HLS.js/mpegts.js if the content type confirms MPEG-TS. A staleness guard prevents the callback firing on stale results after the user has closed or switched the player.Test plan
🤖 Generated with Claude Code