@hyperframes/core 0.8.212 → 0.8.213

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,6 +49,8 @@ export declare function isHtmlElement(value: unknown): value is HTMLElement;
49
49
  export declare function isVideoElement(value: unknown): value is HTMLVideoElement;
50
50
  /** `<audio>`, from any realm. Mirrors `instanceof HTMLAudioElement`. */
51
51
  export declare function isAudioElement(value: unknown): value is HTMLAudioElement;
52
+ /** `<source>`, from any realm. Mirrors `instanceof HTMLSourceElement`. */
53
+ export declare function isSourceElement(value: unknown): value is HTMLSourceElement;
52
54
  /** `<video>` or `<audio>`, from any realm. Mirrors `instanceof HTMLMediaElement`. */
53
55
  export declare function isMediaElement(value: unknown): value is HTMLMediaElement;
54
56
  /** `<img>`, from any realm. Mirrors `instanceof HTMLImageElement`. */
@@ -63,6 +63,10 @@ export function isVideoElement(value) {
63
63
  export function isAudioElement(value) {
64
64
  return isHtmlTag(value, "audio");
65
65
  }
66
+ /** `<source>`, from any realm. Mirrors `instanceof HTMLSourceElement`. */
67
+ export function isSourceElement(value) {
68
+ return isHtmlTag(value, "source");
69
+ }
66
70
  /** `<video>` or `<audio>`, from any realm. Mirrors `instanceof HTMLMediaElement`. */
67
71
  export function isMediaElement(value) {
68
72
  return isVideoElement(value) || isAudioElement(value);
@@ -1,5 +1,6 @@
1
1
  export declare const RUNTIME_PROTOCOL_VERSION: 1;
2
2
  export declare const RUNTIME_FILLER = "hf-runtime-filler";
3
+ export declare const RUNTIME_MEDIA_LOAD_FAILED = "runtime_media_load_failed";
3
4
  export declare const RUNTIME_PROTOCOL_CAPABILITIES: readonly ["seconds-time", "rational-fps", "seek-keep-playing", "composition-manifest-v1", "runtime-data", "play-range"];
4
5
  export type RuntimeProtocolFps = {
5
6
  numerator: number;
@@ -28,3 +29,15 @@ export declare function runtimeProtocolFpsToNumber(value: unknown): number | nul
28
29
  export declare function runtimeProtocolMetadata(fps: number): RuntimeProtocolV1;
29
30
  export declare function frameDisplayScale(frame: HTMLElement): number | null;
30
31
  export declare function inspectRuntimeProtocol(value: unknown, legacyFps?: number): RuntimeProtocolInspection;
32
+ declare const STAGES: readonly ["fetch", "decode", "element"];
33
+ export type MediaLoadStage = (typeof STAGES)[number];
34
+ export interface MediaLoadFailure {
35
+ elementId: string | null;
36
+ kind: string;
37
+ stage: MediaLoadStage;
38
+ code: number | null;
39
+ bytes: number | null;
40
+ extension: string | null;
41
+ }
42
+ export declare function parseMediaLoadFailure(value: unknown): MediaLoadFailure | null;
43
+ export {};
@@ -1,5 +1,6 @@
1
1
  export const RUNTIME_PROTOCOL_VERSION = 1;
2
2
  export const RUNTIME_FILLER = "hf-runtime-filler";
3
+ export const RUNTIME_MEDIA_LOAD_FAILED = "runtime_media_load_failed";
3
4
  export const RUNTIME_PROTOCOL_CAPABILITIES = [
4
5
  "seconds-time",
5
6
  "rational-fps",
@@ -81,3 +82,22 @@ export function inspectRuntimeProtocol(value, legacyFps = 30) {
81
82
  metadata: message,
82
83
  };
83
84
  }
85
+ const STAGES = ["fetch", "decode", "element"];
86
+ const numberOrNull = (n) => (typeof n === "number" ? n : null);
87
+ const stringOrNull = (s) => (typeof s === "string" ? s : null);
88
+ export function parseMediaLoadFailure(value) {
89
+ if (typeof value !== "object" || value === null)
90
+ return null;
91
+ const { elementId, kind, stage, code, bytes, extension } = value;
92
+ const known = STAGES.find((s) => s === stage);
93
+ if (!known || typeof kind !== "string")
94
+ return null;
95
+ return {
96
+ elementId: stringOrNull(elementId),
97
+ kind,
98
+ stage: known,
99
+ code: numberOrNull(code),
100
+ bytes: numberOrNull(bytes),
101
+ extension: stringOrNull(extension),
102
+ };
103
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.8.212",
3
+ "version": "0.8.213",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -425,9 +425,9 @@
425
425
  "linkedom": "^0.18.12",
426
426
  "postcss": "^8.5.8",
427
427
  "wawoff2": "^2.0.1",
428
- "@hyperframes/lint": "0.8.212",
429
- "@hyperframes/studio-server": "0.8.212",
430
- "@hyperframes/parsers": "0.8.212"
428
+ "@hyperframes/lint": "0.8.213",
429
+ "@hyperframes/parsers": "0.8.213",
430
+ "@hyperframes/studio-server": "0.8.213"
431
431
  },
432
432
  "devDependencies": {
433
433
  "@fontsource/archivo-black": "^5.2.8",