Skip to content

fix(sia-video-source): widen media target types - #1197

Merged
pcfreak30 merged 1 commit into
developfrom
fix/sia-video-source-media-target-types
Sep 24, 2026
Merged

pcfreak30 merged 1 commit into
developfrom
fix/sia-video-source-media-target-types

Conversation

@pcfreak30

@pcfreak30 pcfreak30 commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

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 HTMLVideoElement to HTMLVideoTargetLike, allowing the source to operate with any video-host-compatible element rather than being limited to a plain HTMLVideoElement. 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 accepts HTMLVideoTargetLike | null instead of HTMLVideoElement | null.
    • #forceClearStuckSeek() and the HANDLE message handler no longer cast this.target to HTMLVideoElement; they use the wider HTMLVideoTargetLike type directly.
    • nativeBufferedEnd() now takes HTMLVideoTargetLike instead of HTMLVideoElement.
  • Added type-contract regression tests (video-host-target-contract.spec.ts):

    • Asserts that HTMLVideoTargetLike still exposes a writable numeric currentTime.
    • Asserts that HTMLVideoTargetLike still exposes a buffered property of type TimeRangeLike.

These tests guard against future upstream changes to the @videojs/media video-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 from HTMLVideoElement to HTMLVideoTargetLike makes the source compatible with other video-host targets while preserving type safety through compile-time assertions.

- Accept Video.js media target capabilities in private helpers
- Keep package typechecking clean with contract coverage
@kody-ai

kody-ai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@pcfreak30 pcfreak30 changed the title fix/sia video source media target types fix(sia-video-source): widen media target types Sep 24, 2026
@pcfreak30
pcfreak30 marked this pull request as ready for review September 24, 2026 19:50
@pcfreak30
pcfreak30 merged commit 9b8fb6a into develop Sep 24, 2026
4 checks passed
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.

1 participant