libaribhtml5 0.1.5 → 0.1.8

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.
@@ -0,0 +1,6 @@
1
+ /** Convert the receiver's 48-bit identifier to the 20-digit A-CAS number. */
2
+ export declare function encodeAcasNumber(receiverIdentifier: string): string;
3
+ /** Recover the 48-bit receiver identifier and reject an invalid checksum. */
4
+ export declare function decodeAcasNumber(acasNumber: string): string;
5
+ export declare function verifyAcasNumber(acasNumber: string): boolean;
6
+ export declare function formatAcasNumber(acasNumber: string): string;
@@ -0,0 +1,30 @@
1
+ type ReceiverCanvasSize = {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ type CanvasResizeObserver = Pick<ResizeObserver, 'observe' | 'disconnect'>;
6
+ type ReceiverCanvasControllerOptions = {
7
+ iframe: HTMLIFrameElement;
8
+ viewport: HTMLElement;
9
+ createResizeObserver?: (callback: ResizeObserverCallback) => CanvasResizeObserver;
10
+ };
11
+ /** Owns receiver-canvas geometry and background selection for the host facade. */
12
+ export declare class ReceiverCanvasController {
13
+ private readonly iframe;
14
+ private readonly viewport;
15
+ private readonly resizeObserver;
16
+ private logicalWidth;
17
+ private logicalHeight;
18
+ private lctBackgroundColor;
19
+ private stageBackgroundColor;
20
+ constructor(options: ReceiverCanvasControllerOptions);
21
+ get logicalSize(): ReceiverCanvasSize;
22
+ setLctBackgroundColor(backgroundColorRgb: number | null): void;
23
+ setStageBackgroundColor(backgroundColor: string | null): void;
24
+ resetStageBackground(): void;
25
+ applyScreenSize(width: number, height: number): void;
26
+ fit(): void;
27
+ dispose(): void;
28
+ private applyBackgroundColor;
29
+ }
30
+ export {};
@@ -0,0 +1,27 @@
1
+ import type { AribMediaPlane, AribMediaPlaneLayer } from '../media-plane';
2
+ /** Untrusted runtime-to-host wire message before session and event filtering. */
3
+ export type RuntimeMessage = Record<string, unknown> & {
4
+ type?: string;
5
+ runtimeId?: string;
6
+ event?: string;
7
+ };
8
+ export type AribApplicationReplaceRequest = {
9
+ organizationId: number;
10
+ applicationId: number;
11
+ aitUrl: string | null;
12
+ };
13
+ export type ReceiverMediaPlaneFallback = {
14
+ screenWidth: number;
15
+ screenHeight: number;
16
+ };
17
+ export type ReceiverCanvasSize = {
18
+ width: number;
19
+ height: number;
20
+ };
21
+ /** Normalize the untrusted logical canvas dimensions reported by the runtime. */
22
+ export declare function normalizeReceiverCanvasSize(message: RuntimeMessage): ReceiverCanvasSize | null;
23
+ export declare function normalizeStageBackgroundColor(value: unknown): string | null;
24
+ export declare function normalizeCaptionSubscriptionTags(value: unknown): number[];
25
+ export declare function normalizeApplicationReplaceRequest(message: RuntimeMessage): AribApplicationReplaceRequest | null;
26
+ export declare function normalizeMediaLayer(value: unknown): AribMediaPlaneLayer;
27
+ export declare function normalizeMediaPlane(message: RuntimeMessage, fallback: ReceiverMediaPlaneFallback): AribMediaPlane;
@@ -0,0 +1,40 @@
1
+ import type { ProgramInfo } from '../program-info';
2
+ import type { RuntimeApplicationInformation } from '../runtime/application-controller';
3
+ import type { RuntimeEvent } from '../runtime/stream-event';
4
+ export type RuntimeInstalledSnapshot = {
5
+ captionComponentTags: readonly number[];
6
+ applicationInformation: RuntimeApplicationInformation;
7
+ inputActive: boolean;
8
+ programInfo: ProgramInfo | null;
9
+ };
10
+ type RuntimeSessionControllerOptions = {
11
+ ownerWindow: Window;
12
+ iframe: HTMLIFrameElement;
13
+ origin: string;
14
+ applicationLoadTimeoutMs: number;
15
+ onApplicationLoadTimeout: (url: string) => void;
16
+ };
17
+ /** Owns receiver-to-runtime transport and the runtime installation session. */
18
+ export declare class RuntimeSessionController {
19
+ private readonly ownerWindow;
20
+ private readonly iframe;
21
+ private readonly origin;
22
+ private readonly applicationLoadTimeoutMs;
23
+ private readonly onApplicationLoadTimeout;
24
+ private readonly pendingStreamEvents;
25
+ private activeRuntimeId;
26
+ private applicationLoadTimer;
27
+ private disposed;
28
+ constructor(options: RuntimeSessionControllerOptions);
29
+ get hasActiveRuntime(): boolean;
30
+ matches(runtimeId: unknown): boolean;
31
+ acceptInstalled(runtimeId: string, snapshot: RuntimeInstalledSnapshot, beforeReplay?: () => void): void;
32
+ postToRuntime(event: string, detail?: Record<string, unknown>): void;
33
+ emitStreamEvent(value: RuntimeEvent): void;
34
+ clearPendingStreamEvents(): void;
35
+ invalidate(): void;
36
+ armWatchdog(url: string): void;
37
+ clearWatchdog(): void;
38
+ dispose(): void;
39
+ }
40
+ export {};
@@ -0,0 +1,99 @@
1
+ import type { ReceiverDeviceIdentifierProvider } from '../device-identifier';
2
+ import type { AribMediaPlane, AribMediaPlaneAdapter } from '../media-plane';
3
+ import type { AribProgramGuideHandler, AribProgramGuideUnavailableHandler } from '../program-guide';
4
+ import type { RuntimeApplicationInformation } from '../runtime/install';
5
+ import type { BroadcastResourceStore } from '../runtime/resources';
6
+ import type { ReceiverSystemInformationOverrides } from '../runtime/system-information';
7
+ import type { AribViewerParticipationEvent } from '../viewer-participation';
8
+ import type { AribApplicationReplaceRequest } from './protocol';
9
+ export type AribCaptionPacket = {
10
+ componentTag: number;
11
+ payload?: string;
12
+ dataType?: string;
13
+ tmd?: string;
14
+ data?: string;
15
+ };
16
+ export type AribCaptionSubscription = {
17
+ componentTags: number[];
18
+ };
19
+ export type AribApplicationInformation = RuntimeApplicationInformation;
20
+ export type { AribApplicationReplaceRequest } from './protocol';
21
+ export type AribApplicationReplaceHandler = (request: AribApplicationReplaceRequest) => void | Promise<void>;
22
+ export type AribExitManagedStateHandler = (url: string) => void | Promise<void>;
23
+ /** Return an HTML application to the receiver-owned BML data-broadcasting browser. */
24
+ export type AribLaunchDataBroadcastingBrowserHandler = () => void | Promise<void>;
25
+ export type AribBroadcastClock = {
26
+ /** Absolute broadcast time at the anchor, as Unix epoch milliseconds. */
27
+ epochMilliseconds: number;
28
+ /** Media timeline value which corresponds to epochMilliseconds. */
29
+ mediaTimeSeconds?: number;
30
+ /** Current playback position; enables pause, rate, and seek aware projection. */
31
+ currentMediaTimeSeconds?: () => number;
32
+ };
33
+ export type AribReceiverLifecycleEvent = {
34
+ type: 'loading';
35
+ url: string;
36
+ } | {
37
+ type: 'installed';
38
+ url: string;
39
+ runtimeId: string;
40
+ } | {
41
+ type: 'navigating';
42
+ url: string;
43
+ } | {
44
+ type: 'exited';
45
+ } | {
46
+ type: 'navigation-blocked';
47
+ url: string;
48
+ } | {
49
+ type: 'frame-blocked';
50
+ url: string;
51
+ } | {
52
+ type: 'error';
53
+ message: string;
54
+ };
55
+ export type AribReceiverHostOptions = {
56
+ iframe: HTMLIFrameElement;
57
+ viewport: HTMLElement;
58
+ /** Surface used only by the behind-iframe compatibility adapter. */
59
+ videoSurface?: HTMLElement;
60
+ mediaPlaneAdapter?: AribMediaPlaneAdapter;
61
+ onStatus?: (status: string) => void;
62
+ /** Machine-readable application/runtime lifecycle; never branch on onStatus text. */
63
+ onLifecycle?: (event: AribReceiverLifecycleEvent) => void;
64
+ /** Time to wait for a loaded document to install the receiver runtime. 0 disables the fallback. */
65
+ applicationLoadTimeoutMs?: number;
66
+ onUrlChange?: (url: string) => void;
67
+ onMediaPlane?: (plane: AribMediaPlane) => void;
68
+ /** @deprecated Use onMediaPlane. */
69
+ onVideoPlane?: (plane: AribMediaPlane) => void;
70
+ keepVideoVisible?: boolean;
71
+ /** Allow broadcaster applications to use HTTP origins outside this host. */
72
+ allowExternalNetwork?: boolean;
73
+ /** Same-origin namespace where a Worker or HTTP server exposes carousel data. */
74
+ broadcastBaseUrl?: string | URL;
75
+ /** Optional bridge to a Service Worker, Cache Storage, or carousel VFS. */
76
+ resourceStore?: BroadcastResourceStore;
77
+ /** Receiver/WebView bridge which opens the native EPG or a program detail page. */
78
+ onOpenProgramGuide?: AribProgramGuideHandler;
79
+ /** Active caption components requested by the current broadcast document. */
80
+ onCaptionSubscription?: (subscription: AribCaptionSubscription) => void;
81
+ /** Resolve Application.replaceApplication() through the receiver's current MH-AIT. */
82
+ onReplaceApplication?: AribApplicationReplaceHandler;
83
+ /** Transfer an application to an unmanaged general-application URL. */
84
+ onExitManagedState?: AribExitManagedStateHandler;
85
+ /** Return the current Hybridcast HTML application to its paired BML browser. */
86
+ onLaunchDataBroadcastingBrowser?: AribLaunchDataBroadcastingBrowserHandler;
87
+ /** Override the default browser alert when the receiver cannot open the EPG. */
88
+ onProgramGuideUnavailable?: AribProgramGuideUnavailableHandler;
89
+ /** Receiver identity/capabilities exposed to the broadcast application. */
90
+ systemInformation?: ReceiverSystemInformationOverrides;
91
+ /** Resolve receiver/CAS identifiers; defaults to the bundled Huggy demo identity. */
92
+ getDeviceIdentifier?: ReceiverDeviceIdentifierProvider;
93
+ /** Initial BML general registers exposed through navigator.bmlCompat. */
94
+ bmlGreg?: string[];
95
+ /** Optional user-agent string exposed only within the managed HTML runtime. */
96
+ userAgent?: string;
97
+ /** Receiver UI hook for a TR-B39 viewer-participation corner notification. */
98
+ onViewerParticipation?: (event: AribViewerParticipationEvent) => void;
99
+ };
@@ -1,99 +1,11 @@
1
- import { type RuntimeApplicationInformation, type RuntimeEvent, type RuntimeWindow } from './runtime/install';
1
+ import { type RuntimeEvent, type RuntimeWindow } from './runtime/install';
2
2
  import { type ProgramInfo } from './program-info';
3
- import type { ReceiverSystemInformationOverrides } from './runtime/system-information';
4
- import type { ReceiverDeviceIdentifierProvider } from './device-identifier';
5
- import { type AribMediaPlane, type AribMediaPlaneAdapter } from './media-plane';
6
- import type { BroadcastResourceChange, BroadcastResourceStore } from './runtime/resources';
7
- import { type AribProgramGuideHandler, type AribProgramGuideRequest, type AribProgramGuideUnavailableHandler } from './program-guide';
8
- import { type AribApplicationPresentationState, type AribViewerParticipationEvent, type AribViewerParticipationNotification } from './viewer-participation';
3
+ import type { BroadcastResourceChange } from './runtime/resources';
4
+ import { type AribProgramGuideRequest } from './program-guide';
5
+ import { type AribApplicationPresentationState, type AribViewerParticipationNotification } from './viewer-participation';
6
+ import type { AribApplicationInformation, AribBroadcastClock, AribCaptionPacket, AribReceiverHostOptions } from './receiver/types';
9
7
  export type { AribMediaPlane, AribMediaPlaneAdapter, AribMediaPlaneLayer, AribMediaPlaneStackEntry, AribMediaPlaneUnmountReason, AribVideoPlane, } from './media-plane';
10
- export type AribCaptionPacket = {
11
- componentTag: number;
12
- payload?: string;
13
- dataType?: string;
14
- tmd?: string;
15
- data?: string;
16
- };
17
- export type AribCaptionSubscription = {
18
- componentTags: number[];
19
- };
20
- export type AribApplicationInformation = RuntimeApplicationInformation;
21
- export type AribApplicationReplaceRequest = {
22
- organizationId: number;
23
- applicationId: number;
24
- aitUrl: string | null;
25
- };
26
- export type AribApplicationReplaceHandler = (request: AribApplicationReplaceRequest) => void | Promise<void>;
27
- export type AribExitManagedStateHandler = (url: string) => void | Promise<void>;
28
- export type AribBroadcastClock = {
29
- /** Absolute broadcast time at the anchor, as Unix epoch milliseconds. */
30
- epochMilliseconds: number;
31
- /** Media timeline value which corresponds to epochMilliseconds. */
32
- mediaTimeSeconds?: number;
33
- /** Current playback position; enables pause, rate, and seek aware projection. */
34
- currentMediaTimeSeconds?: () => number;
35
- };
36
- export type AribReceiverLifecycleEvent = {
37
- type: 'loading';
38
- url: string;
39
- } | {
40
- type: 'installed';
41
- url: string;
42
- runtimeId: string;
43
- } | {
44
- type: 'navigating';
45
- url: string;
46
- } | {
47
- type: 'exited';
48
- } | {
49
- type: 'navigation-blocked';
50
- url: string;
51
- } | {
52
- type: 'frame-blocked';
53
- url: string;
54
- } | {
55
- type: 'error';
56
- message: string;
57
- };
58
- export type AribReceiverHostOptions = {
59
- iframe: HTMLIFrameElement;
60
- viewport: HTMLElement;
61
- /** Surface used only by the behind-iframe compatibility adapter. */
62
- videoSurface?: HTMLElement;
63
- mediaPlaneAdapter?: AribMediaPlaneAdapter;
64
- onStatus?: (status: string) => void;
65
- /** Machine-readable application/runtime lifecycle; never branch on onStatus text. */
66
- onLifecycle?: (event: AribReceiverLifecycleEvent) => void;
67
- /** Time to wait for a loaded document to install the receiver runtime. 0 disables the fallback. */
68
- applicationLoadTimeoutMs?: number;
69
- onUrlChange?: (url: string) => void;
70
- onMediaPlane?: (plane: AribMediaPlane) => void;
71
- /** @deprecated Use onMediaPlane. */
72
- onVideoPlane?: (plane: AribMediaPlane) => void;
73
- keepVideoVisible?: boolean;
74
- /** Allow broadcaster applications to use HTTP origins outside this host. */
75
- allowExternalNetwork?: boolean;
76
- /** Same-origin namespace where a Worker or HTTP server exposes carousel data. */
77
- broadcastBaseUrl?: string | URL;
78
- /** Optional bridge to a Service Worker, Cache Storage, or carousel VFS. */
79
- resourceStore?: BroadcastResourceStore;
80
- /** Receiver/WebView bridge which opens the native EPG or a program detail page. */
81
- onOpenProgramGuide?: AribProgramGuideHandler;
82
- /** Active caption components requested by the current broadcast document. */
83
- onCaptionSubscription?: (subscription: AribCaptionSubscription) => void;
84
- /** Resolve Application.replaceApplication() through the receiver's current MH-AIT. */
85
- onReplaceApplication?: AribApplicationReplaceHandler;
86
- /** Transfer an application to an unmanaged general-application URL. */
87
- onExitManagedState?: AribExitManagedStateHandler;
88
- /** Override the default browser alert when the receiver cannot open the EPG. */
89
- onProgramGuideUnavailable?: AribProgramGuideUnavailableHandler;
90
- /** Receiver identity/capabilities exposed to the broadcast application. */
91
- systemInformation?: ReceiverSystemInformationOverrides;
92
- /** Resolve receiver/CAS identifiers; defaults to the bundled Huggy demo identity. */
93
- getDeviceIdentifier?: ReceiverDeviceIdentifierProvider;
94
- /** Receiver UI hook for a TR-B39 viewer-participation corner notification. */
95
- onViewerParticipation?: (event: AribViewerParticipationEvent) => void;
96
- };
8
+ export type { AribApplicationInformation, AribApplicationReplaceHandler, AribApplicationReplaceRequest, AribBroadcastClock, AribCaptionPacket, AribCaptionSubscription, AribExitManagedStateHandler, AribLaunchDataBroadcastingBrowserHandler, AribReceiverHostOptions, AribReceiverLifecycleEvent, } from './receiver/types';
97
9
  export declare class AribReceiverHost {
98
10
  readonly iframe: HTMLIFrameElement;
99
11
  readonly viewport: HTMLElement;
@@ -115,29 +27,28 @@ export declare class AribReceiverHost {
115
27
  private readonly onCaptionSubscription?;
116
28
  private readonly onReplaceApplication?;
117
29
  private readonly onExitManagedState?;
30
+ private readonly onLaunchDataBroadcastingBrowser?;
118
31
  private readonly onProgramGuideUnavailable?;
119
32
  private readonly systemInformation?;
120
33
  private readonly getDeviceIdentifier?;
34
+ private readonly bmlGreg;
35
+ private readonly userAgent?;
121
36
  private readonly onViewerParticipation?;
122
37
  private readonly viewerParticipation;
123
- private readonly resizeObserver;
124
- private activeRuntimeId;
125
- private logicalWidth;
126
- private logicalHeight;
38
+ private readonly canvas;
39
+ private readonly runtimeSession;
127
40
  private captionComponentTags;
128
41
  private applicationInformation;
129
42
  private programInfo;
130
- private readonly pendingStreamEvents;
131
43
  private broadcastClock;
132
- private lctBackgroundColor;
133
- private stageBackgroundColor;
134
44
  private video;
135
45
  private mediaPlaneEnabled;
136
46
  private applicationExited;
137
- private applicationLoadTimer;
138
47
  private destroyed;
139
48
  constructor(options: AribReceiverHostOptions);
140
49
  installRuntime(target: RuntimeWindow): void;
50
+ /** Replace BML general registers while retaining the active runtime reference. */
51
+ setBmlGreg(values: readonly string[]): void;
141
52
  /** Set the MH-AIT identity exposed by applicationManager.getOwnerApplication(). */
142
53
  setApplicationInformation(application: AribApplicationInformation | null): void;
143
54
  /**
@@ -184,13 +95,8 @@ export declare class AribReceiverHost {
184
95
  private readonly reportProgramGuideUnavailable;
185
96
  private readonly handleRuntimeMessage;
186
97
  private applyMediaPlane;
187
- private readMediaLayer;
188
- private postToRuntime;
189
- private armApplicationLoadTimer;
190
98
  private failApplicationLoad;
191
- private clearApplicationLoadTimer;
192
99
  private invalidateRuntime;
193
- private fitBroadcastCanvas;
100
+ private disableRuntime;
194
101
  private assertAlive;
195
- private applyReceiverBackgroundColor;
196
102
  }
@@ -0,0 +1,48 @@
1
+ import { type AribPermissionBit, type RuntimePermissionManagedArea } from './application-boundary';
2
+ type RuntimeWindow = Window & typeof globalThis & Record<string, unknown>;
3
+ export type RuntimeApplicationInformation = {
4
+ type?: string;
5
+ organizationId?: number;
6
+ applicationId?: number;
7
+ controlCode?: string;
8
+ autostartPriority?: number;
9
+ /** Decoded loops from MH-AIT descriptor 0x802C. Omit when absent. */
10
+ permissionManagedAreas?: readonly RuntimePermissionManagedArea[];
11
+ };
12
+ type RuntimeApplicationControllerOptions = {
13
+ target: RuntimeWindow;
14
+ broadcastBaseUrl: string | URL;
15
+ resolveRuntimeUrl: (value: unknown) => URL;
16
+ allowExternalNetwork: boolean;
17
+ application?: RuntimeApplicationInformation;
18
+ postRuntime: (event: string, detail?: Record<string, unknown>) => void;
19
+ };
20
+ /** Owns the application-manager, permission-boundary, and navigation state. */
21
+ export declare class RuntimeApplicationController {
22
+ private readonly target;
23
+ private readonly resolveRuntimeUrl;
24
+ private readonly allowExternalNetwork;
25
+ private readonly postRuntime;
26
+ private readonly boundary;
27
+ private applicationInformation;
28
+ private applicationVisible;
29
+ private applicationInputActive;
30
+ private navigationCaptureInstalled;
31
+ private readonly keySet;
32
+ private readonly boundaryDescriptor;
33
+ private readonly ownerApplication;
34
+ constructor(options: RuntimeApplicationControllerOptions);
35
+ requirePermission(bit: AribPermissionBit): void;
36
+ permits(bit: AribPermissionBit): boolean;
37
+ updateApplicationInformation(value: RuntimeApplicationInformation): boolean;
38
+ setHostInputActive(active: boolean): void;
39
+ startDocument(): void;
40
+ startNavigationCapture(): void;
41
+ dispose(): void;
42
+ private applyApplicationVisibility;
43
+ private reportApplicationPresentation;
44
+ private reportBlockedNavigation;
45
+ private allowedNavigationUrl;
46
+ private readonly handleDocumentClick;
47
+ }
48
+ export {};
@@ -0,0 +1,27 @@
1
+ type RuntimeCaptionControllerOptions = {
2
+ requirePermission: () => void;
3
+ postRuntime: (event: string, detail?: Record<string, unknown>) => void;
4
+ };
5
+ type RuntimeCaptionMessage = {
6
+ event?: unknown;
7
+ componentTags?: Iterable<unknown> | null;
8
+ componentTag?: unknown;
9
+ payload?: unknown;
10
+ dataType?: unknown;
11
+ tmd?: unknown;
12
+ data?: unknown;
13
+ };
14
+ /** Owns the document-side caption tracks, subscriptions, and broadcast object API. */
15
+ export declare class RuntimeCaptionController {
16
+ private readonly requirePermission;
17
+ private readonly postRuntime;
18
+ private readonly tracks;
19
+ private readonly listeners;
20
+ constructor(options: RuntimeCaptionControllerOptions);
21
+ readonly installBroadcastObjectApi: (element: HTMLElement) => void;
22
+ /** Handle a host caption event; return false when it belongs to another subsystem. */
23
+ handleHostMessage(message: RuntimeCaptionMessage): boolean;
24
+ private componentTag;
25
+ private reportSubscriptions;
26
+ }
27
+ export {};
@@ -0,0 +1,28 @@
1
+ import type { AribMediaPlaneStackEntry } from '../media-plane';
2
+ type RuntimeWindow = Window & typeof globalThis;
3
+ /**
4
+ * Temporarily clears the DOM paint that covers an externally composed media
5
+ * plane and restores the exact inline values when the slot changes or exits.
6
+ */
7
+ export declare class ExternalMediaHoleController {
8
+ private readonly target;
9
+ private readonly placeholderOpacities;
10
+ private readonly backgrounds;
11
+ constructor(target: RuntimeWindow);
12
+ set(object: HTMLElement, enabled: boolean): void;
13
+ restore(): void;
14
+ /** Read application styles while temporarily exposing backgrounds hidden for external video. */
15
+ withApplicationBackgrounds<T>(callback: () => T): T;
16
+ describeStackingPath(object: HTMLElement): AribMediaPlaneStackEntry[];
17
+ private hasTransparentBackground;
18
+ private placeholderElements;
19
+ private setPlaceholder;
20
+ private restorePlaceholder;
21
+ private restorePlaceholders;
22
+ private restoreBackground;
23
+ private applyBackground;
24
+ private captureApplicationBackgroundChanges;
25
+ private clearBackground;
26
+ private restoreBackgrounds;
27
+ }
28
+ export {};
@@ -0,0 +1,7 @@
1
+ type ExternalNetworkTarget = Window & typeof globalThis;
2
+ /**
3
+ * Make the receiver's optional external HTTP communication path fail fast while
4
+ * preserving same-origin access to receiver-managed broadcast resources.
5
+ */
6
+ export declare function installExternalNetworkPolicy(target: ExternalNetworkTarget, allowExternalNetwork: boolean | undefined): void;
7
+ export {};
@@ -3,10 +3,11 @@ import type { AribMediaPlaneAdapter } from '../media-plane';
3
3
  import { type BroadcastResourceStore } from './resources';
4
4
  import { type ReceiverSystemInformationOverrides } from './system-information';
5
5
  import { type ReceiverDeviceIdentifierProvider } from '../device-identifier';
6
- import { type RuntimePermissionManagedArea } from './application-boundary';
6
+ import { type RuntimeApplicationInformation } from './application-controller';
7
7
  export type { ProgramInfo } from '../program-info';
8
8
  export type { RuntimeEvent, RuntimeEventSelector, RuntimeEventSource, } from './stream-event';
9
9
  export type { AribPermissionManagedArea, RuntimePermissionManagedArea, } from './application-boundary';
10
+ export type { RuntimeApplicationInformation } from './application-controller';
10
11
  export type RuntimeWindow = Window & typeof globalThis & Record<string, unknown>;
11
12
  export type RuntimeOptions = {
12
13
  /** Permit HTTP requests outside the receiver-managed application origin. */
@@ -25,14 +26,9 @@ export type RuntimeOptions = {
25
26
  getDeviceIdentifier?: ReceiverDeviceIdentifierProvider;
26
27
  /** MH-AIT metadata for the application which owns this document. */
27
28
  application?: RuntimeApplicationInformation;
28
- };
29
- export type RuntimeApplicationInformation = {
30
- type?: string;
31
- organizationId?: number;
32
- applicationId?: number;
33
- controlCode?: string;
34
- autostartPriority?: number;
35
- /** Decoded loops from MH-AIT descriptor 0x802C. Omit when absent. */
36
- permissionManagedAreas?: readonly RuntimePermissionManagedArea[];
29
+ /** Receiver-owned BML general registers shared with a paired BML engine. */
30
+ bmlGreg?: string[];
31
+ /** Optional receiver identity token exposed to HTML application feature detection. */
32
+ userAgent?: string;
37
33
  };
38
34
  export declare function installRuntime(target: RuntimeWindow, options?: RuntimeOptions): void;
@@ -0,0 +1,56 @@
1
+ import type { AribMediaPlaneAdapter, AribMediaPlaneUnmountReason } from '../media-plane';
2
+ type RuntimeWindow = Window & typeof globalThis;
3
+ type RuntimeMediaPlaneControllerOptions = {
4
+ target: RuntimeWindow;
5
+ adapter?: AribMediaPlaneAdapter;
6
+ canUseBroadcastMedia: () => boolean;
7
+ installBroadcastObjectApi: (object: HTMLElement) => void;
8
+ postRuntime: (event: string, detail?: Record<string, unknown>) => void;
9
+ };
10
+ /** Owns the document-side media-plane observation and compositor lifecycle. */
11
+ export declare class RuntimeMediaPlaneController {
12
+ private readonly target;
13
+ private readonly adapter?;
14
+ private readonly canUseBroadcastMedia;
15
+ private readonly installBroadcastObjectApi;
16
+ private readonly postRuntime;
17
+ private readonly mediaObjectIds;
18
+ private readonly externalMediaHole;
19
+ private readonly resizeObserver;
20
+ private applicationCanvasStyle;
21
+ private mutationObserver;
22
+ private nextMediaObjectId;
23
+ private activeMediaObject;
24
+ private lastMediaPlane;
25
+ private lastScreenSize;
26
+ private lastStageBackgroundColor;
27
+ private observedMediaObject;
28
+ private mediaPlaneFrame;
29
+ private observing;
30
+ private disposed;
31
+ constructor(options: RuntimeMediaPlaneControllerOptions);
32
+ /** Install APIs needed by static objects, prepare the canvas, and queue a report. */
33
+ startDocument(): void;
34
+ /** Start document observers after the runtime's installed handshake was sent. */
35
+ startObserving(): void;
36
+ readonly schedule: () => void;
37
+ /**
38
+ * Stop observation, run document-owned cleanup, then restore and unmount the
39
+ * media plane. The cleanup hook preserves the original pagehide ordering.
40
+ */
41
+ dispose(reason: Extract<AribMediaPlaneUnmountReason, 'document-unload'>, beforeUnmount?: () => void): void;
42
+ private findMediaObject;
43
+ private reportStageStyle;
44
+ private prepareExternalMediaPlaneCanvas;
45
+ private withApplicationCanvasBackgrounds;
46
+ private observeDocumentMutations;
47
+ private activeMediaAnimation;
48
+ private observeMediaObject;
49
+ private logicalViewport;
50
+ private reportScreenSize;
51
+ private slotIdFor;
52
+ private callMediaPlaneAdapter;
53
+ private unmountMediaPlane;
54
+ private reportMediaPlane;
55
+ }
56
+ export {};
@@ -1,84 +1,3 @@
1
- export type BroadcastVfsResource = {
2
- path: string;
3
- contentType?: string;
4
- data: Uint8Array | ArrayBuffer;
5
- };
6
- export type ServiceWorkerBroadcastVfsOptions = {
7
- workerUrl: string | URL;
8
- /** Same-origin scope used to expose broadcast files. */
9
- baseUrl?: string | URL;
10
- /** Compatibility fallback for applications which omit a carousel directory. */
11
- uniqueBasenameFallback?: boolean;
12
- };
13
- export type BroadcastVfsBackend = {
14
- begin(): Promise<void>;
15
- put(resource: BroadcastVfsResource): Promise<void>;
16
- canRead(path: string): Promise<boolean>;
17
- };
18
- export type BroadcastVfsSessionOptions = {
19
- /** Report background write failures; ensure() still rejects to its caller. */
20
- onError?: (error: unknown) => void;
21
- /** Override background scheduling, primarily for embedded hosts and tests. */
22
- schedule?: (task: () => void) => void;
23
- };
24
- /**
25
- * Ordered, recoverable write session above a VFS backend. enqueue() copies
26
- * callback-lifetime data synchronously and returns a revision barrier.
27
- */
28
- export declare class BroadcastVfsSession {
29
- private readonly backend;
30
- private readonly onError?;
31
- private readonly scheduleTask;
32
- private readonly mirror;
33
- private readonly queue;
34
- private waiters;
35
- private generation;
36
- private nextRevision;
37
- private completedRevision;
38
- private drainScheduled;
39
- private ioTail;
40
- private sessionReady;
41
- private disposed;
42
- constructor(backend: BroadcastVfsBackend, options?: BroadcastVfsSessionOptions);
43
- beginSession(): Promise<void>;
44
- enqueue(resource: BroadcastVfsResource): number;
45
- waitFor(revision: number): Promise<void>;
46
- /** Ensure a staged path is readable, replaying the page-owned mirror if needed. */
47
- ensure(path: string, revision?: number): Promise<void>;
48
- /**
49
- * Stop accepting resources, discard queued writes, and wait for the one
50
- * backend operation which may already be running. The backend itself remains
51
- * owned by the caller and can be reset or disposed after this resolves.
52
- */
53
- dispose(): Promise<void>;
54
- private appendIo;
55
- private scheduleDrain;
56
- private drainOne;
57
- private resolveWaiters;
58
- }
59
- export declare class ServiceWorkerBroadcastVfs {
60
- private readonly workerUrl;
61
- private readonly scopeUrl;
62
- private readonly uniqueBasenameFallback;
63
- private registration;
64
- private ready;
65
- private readonly inFlight;
66
- private disposing;
67
- private disposed;
68
- constructor(options: ServiceWorkerBroadcastVfsOptions);
69
- initialize(): Promise<ServiceWorkerRegistration>;
70
- begin(): Promise<void>;
71
- put(resource: BroadcastVfsResource): Promise<void>;
72
- canRead(path: string): Promise<boolean>;
73
- reset(): Promise<void>;
74
- /**
75
- * Clear the receiver-owned VFS session after outstanding requests finish.
76
- * The shared Service Worker registration is intentionally retained so other
77
- * tabs and future receiver instances keep a stable scoped fetch handler.
78
- */
79
- dispose(): Promise<void>;
80
- private request;
81
- private performRequest;
82
- private performRequestWithRegistration;
83
- private waitForActivation;
84
- }
1
+ export { BroadcastVfsSession } from './vfs/session.js';
2
+ export { ServiceWorkerBroadcastVfs } from './vfs/service-worker-backend.js';
3
+ export type { BroadcastVfsBackend, BroadcastVfsResource, BroadcastVfsSessionOptions, ServiceWorkerBroadcastVfsOptions, } from './vfs/types.js';
@@ -0,0 +1,8 @@
1
+ type TvReceiverIframe = Pick<HTMLIFrameElement, 'contentWindow' | 'inert' | 'style' | 'tabIndex'>;
2
+ /** Keep pointer input on the native TV shell without making the child document inert. */
3
+ export declare function configureTvReceiverIframe(iframe: TvReceiverIframe): void;
4
+ /** Dispatch a receiver key in the child browsing context that owns the application DOM. */
5
+ export declare function dispatchReceiverKey(iframe: TvReceiverIframe, code: number): boolean;
6
+ /** @deprecated Use dispatchReceiverKey(). */
7
+ export declare const dispatchTvReceiverKey: typeof dispatchReceiverKey;
8
+ export {};