fix(sia-video-source): widen media target types - #1197
Merged
Merged
Conversation
- Accept Video.js media target capabilities in private helpers - Keep package typechecking clean with contract coverage
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
pcfreak30
marked this pull request as ready for review
September 24, 2026 19:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates private helpers to accept Video.js media target capabilities instead of requiring a concrete HTML video element.
Adds structural contract coverage and leaves runtime output and public declarations unchanged.
Summary
This PR widens the media target type used by SiaVideoSource internal helpers from
HTMLVideoElementtoHTMLVideoTargetLike, allowing the source to operate with any video-host-compatible element rather than being limited to a plainHTMLVideoElement. It also adds compile-time regression tests that pin the structural contract the widened helpers depend on.Changes
Broadened target types in internal helpers (
sia-video-source.ts):#applyPendingReanchor()now acceptsHTMLVideoTargetLike | nullinstead ofHTMLVideoElement | null.#forceClearStuckSeek()and theHANDLEmessage handler no longer castthis.targettoHTMLVideoElement; they use the widerHTMLVideoTargetLiketype directly.nativeBufferedEnd()now takesHTMLVideoTargetLikeinstead ofHTMLVideoElement.Added type-contract regression tests (
video-host-target-contract.spec.ts):HTMLVideoTargetLikestill exposes a writable numericcurrentTime.HTMLVideoTargetLikestill exposes abufferedproperty of typeTimeRangeLike.These tests guard against future upstream changes to the
@videojs/mediavideo-host types that could silently break the widened parameter assumptions.Why
The Sia video source relies on common media-element capabilities (
currentTime,buffered,srcObject, etc.) rather than anything video-specific. Switching the internal helper signatures fromHTMLVideoElementtoHTMLVideoTargetLikemakes the source compatible with other video-host targets while preserving type safety through compile-time assertions.