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.
- package/README.md +3 -0
- package/dist/sdk/libaribhtml5.js +10 -10
- package/dist/sdk/libaribhtml5.mjs +1562 -1204
- package/dist/types/acas-number.d.ts +6 -0
- package/dist/types/receiver/canvas-controller.d.ts +30 -0
- package/dist/types/receiver/protocol.d.ts +27 -0
- package/dist/types/receiver/runtime-session-controller.d.ts +40 -0
- package/dist/types/receiver/types.d.ts +99 -0
- package/dist/types/receiver-host.d.ts +14 -108
- package/dist/types/runtime/application-controller.d.ts +48 -0
- package/dist/types/runtime/caption-controller.d.ts +27 -0
- package/dist/types/runtime/external-media-hole.d.ts +28 -0
- package/dist/types/runtime/external-network.d.ts +7 -0
- package/dist/types/runtime/install.d.ts +6 -10
- package/dist/types/runtime/media-plane-runtime.d.ts +56 -0
- package/dist/types/service-worker-vfs.d.ts +3 -84
- package/dist/types/tv-input.d.ts +8 -0
- package/dist/types/vfs/service-worker-backend.d.ts +27 -0
- package/dist/types/vfs/session.d.ts +36 -0
- package/dist/types/vfs/types.d.ts +23 -0
- package/docs/application-lifecycle.md +26 -0
- package/docs/images/bs8k-contract.webp +0 -0
- package/docs/images/bs8k-message-removal.webp +0 -0
- package/docs/receiver-host-contracts.md +20 -0
- package/package.json +3 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { BroadcastVfsResource, ServiceWorkerBroadcastVfsOptions } from './types.js';
|
|
2
|
+
export declare class ServiceWorkerBroadcastVfs {
|
|
3
|
+
private readonly workerUrl;
|
|
4
|
+
private readonly scopeUrl;
|
|
5
|
+
private readonly uniqueBasenameFallback;
|
|
6
|
+
private registration;
|
|
7
|
+
private ready;
|
|
8
|
+
private readonly inFlight;
|
|
9
|
+
private disposing;
|
|
10
|
+
private disposed;
|
|
11
|
+
constructor(options: ServiceWorkerBroadcastVfsOptions);
|
|
12
|
+
initialize(): Promise<ServiceWorkerRegistration>;
|
|
13
|
+
begin(): Promise<void>;
|
|
14
|
+
put(resource: BroadcastVfsResource): Promise<void>;
|
|
15
|
+
canRead(path: string): Promise<boolean>;
|
|
16
|
+
reset(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Clear the receiver-owned VFS session after outstanding requests finish.
|
|
19
|
+
* The shared Service Worker registration is intentionally retained so other
|
|
20
|
+
* tabs and future receiver instances keep a stable scoped fetch handler.
|
|
21
|
+
*/
|
|
22
|
+
dispose(): Promise<void>;
|
|
23
|
+
private request;
|
|
24
|
+
private performRequest;
|
|
25
|
+
private performRequestWithRegistration;
|
|
26
|
+
private waitForActivation;
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { BroadcastVfsBackend, BroadcastVfsResource, BroadcastVfsSessionOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Ordered, recoverable write session above a VFS backend. enqueue() copies
|
|
4
|
+
* callback-lifetime data synchronously and returns a revision barrier.
|
|
5
|
+
*/
|
|
6
|
+
export declare class BroadcastVfsSession {
|
|
7
|
+
private readonly backend;
|
|
8
|
+
private readonly onError?;
|
|
9
|
+
private readonly scheduleTask;
|
|
10
|
+
private readonly mirror;
|
|
11
|
+
private readonly queue;
|
|
12
|
+
private waiters;
|
|
13
|
+
private generation;
|
|
14
|
+
private nextRevision;
|
|
15
|
+
private completedRevision;
|
|
16
|
+
private drainScheduled;
|
|
17
|
+
private ioTail;
|
|
18
|
+
private sessionReady;
|
|
19
|
+
private disposed;
|
|
20
|
+
constructor(backend: BroadcastVfsBackend, options?: BroadcastVfsSessionOptions);
|
|
21
|
+
beginSession(): Promise<void>;
|
|
22
|
+
enqueue(resource: BroadcastVfsResource): number;
|
|
23
|
+
waitFor(revision: number): Promise<void>;
|
|
24
|
+
/** Ensure a staged path is readable, replaying the page-owned mirror if needed. */
|
|
25
|
+
ensure(path: string, revision?: number): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Stop accepting resources, discard queued writes, and wait for the one
|
|
28
|
+
* backend operation which may already be running. The backend itself remains
|
|
29
|
+
* owned by the caller and can be reset or disposed after this resolves.
|
|
30
|
+
*/
|
|
31
|
+
dispose(): Promise<void>;
|
|
32
|
+
private appendIo;
|
|
33
|
+
private scheduleDrain;
|
|
34
|
+
private drainOne;
|
|
35
|
+
private resolveWaiters;
|
|
36
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
};
|
|
@@ -35,6 +35,23 @@
|
|
|
35
35
|
別 application へ切り替える必要がある場合、実行中のページが
|
|
36
36
|
`navigator.applicationManager.getOwnerApplication().replaceApplication(...)` を呼びます。
|
|
37
37
|
|
|
38
|
+
## BML から Hybridcast への状態移行
|
|
39
|
+
|
|
40
|
+
BML engine が AIT 制御 HTML application へ制御を渡す場合、general register は receiver host が
|
|
41
|
+
所有します。BML 側から受け取った register snapshot を、HTML document を読み込む前に
|
|
42
|
+
`host.setBmlGreg()` で渡してください。runtime は同じ receiver-owned array を
|
|
43
|
+
`navigator.bmlCompat.browserPseudo.Greg` として公開します。
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
host.setBmlGreg(bmlTransition.greg)
|
|
47
|
+
host.setApplicationInformation(aitApplication)
|
|
48
|
+
host.loadApplication(htmlEntryPoint)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`setBmlGreg()` は active runtime が参照する array identity を維持するため、document を残したまま
|
|
52
|
+
更新しても state が分断されません。受信機識別子や operator policy は別の receiver API が所有し、
|
|
53
|
+
general register を識別子として扱ってはいけません。
|
|
54
|
+
|
|
38
55
|
## replaceApplication
|
|
39
56
|
|
|
40
57
|
ARIB STD-B62 第二編 3.3.7–3.3.8 は `ApplicationManager` と `Application` を定義します。
|
|
@@ -65,6 +82,15 @@ const host = new AribReceiverHost({
|
|
|
65
82
|
許可境界と外部 network policy を receiver 側で検証し、対応する場合だけ
|
|
66
83
|
`onExitManagedState` で処理します。
|
|
67
84
|
|
|
85
|
+
## BML ブラウザへの復帰
|
|
86
|
+
|
|
87
|
+
Hybridcast HTML application は
|
|
88
|
+
`navigator.applicationManager.launchDataBroadcastingBrowser()` で、起動元の
|
|
89
|
+
BML data-broadcasting browser への復帰を receiver に要求できます。runtime はこの要求を
|
|
90
|
+
`AribReceiverHostOptions.onLaunchDataBroadcastingBrowser` に渡します。host は BML session を
|
|
91
|
+
保持したまま HTML application plane を閉じ、BML browser を再表示してください。callback がない
|
|
92
|
+
場合は要求を成功扱いにせず、runtime は現在の application を維持します。
|
|
93
|
+
|
|
68
94
|
## アプリケーション境界と権限
|
|
69
95
|
|
|
70
96
|
MH-AIT の `MH-Application Boundary and Permission Descriptor` (`descriptor_tag=0x802C`)
|
|
Binary file
|
|
Binary file
|
|
@@ -58,6 +58,26 @@ read-only through the legacy `receiverinfo` Ureg used by broadcaster apps. The
|
|
|
58
58
|
host owns persistence and passes a snapshot; writes inside the app do not flow
|
|
59
59
|
back into the host's settings.
|
|
60
60
|
|
|
61
|
+
## HTML application canvas
|
|
62
|
+
|
|
63
|
+
The runtime reads `width` and `height` from the document's
|
|
64
|
+
`meta[name="viewport"]` and sends the declared logical canvas to the receiver
|
|
65
|
+
host. A document declaring `width=1920,height=1080` is rendered as a 1920×1080
|
|
66
|
+
application plane and fitted inside `viewport`; this also applies when the
|
|
67
|
+
document has no ARIB broadcast-media object. The default remains 3840×2160 when
|
|
68
|
+
the declaration is absent or invalid.
|
|
69
|
+
|
|
70
|
+
This is an application-document contract, not a broadcaster or transport
|
|
71
|
+
profile. Hosts must not override it with station-specific CSS sizing rules.
|
|
72
|
+
|
|
73
|
+
## HTML user agent
|
|
74
|
+
|
|
75
|
+
An integrating receiver may provide `userAgent` when it needs to expose an
|
|
76
|
+
honest Hybridcast capability token to managed HTML documents. The value is
|
|
77
|
+
installed before document scripts execute and restored when that runtime is
|
|
78
|
+
unloaded. The SDK does not add a broadcaster, smart-card, or device-vendor
|
|
79
|
+
identity on its own.
|
|
80
|
+
|
|
61
81
|
## Device identifiers
|
|
62
82
|
|
|
63
83
|
The default package combination remains `huggy`, `Huggy ARIB HTML5 Receiver`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libaribhtml5",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Browser runtime and receiver host for ARIB HTML5 data broadcasting",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arib",
|
|
@@ -60,9 +60,10 @@
|
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"dev": "vite --host 127.0.0.1",
|
|
63
|
-
"test": "node --experimental-strip-types scripts/test-runtime-contracts.mjs && node --experimental-strip-types scripts/test-vfs-worker.mjs",
|
|
63
|
+
"test": "node --experimental-strip-types scripts/test-runtime-contracts.mjs && node --experimental-strip-types scripts/test-external-network.mjs && node --experimental-strip-types scripts/test-caption-controller.mjs && node --experimental-strip-types scripts/test-runtime-application.mjs && node --experimental-strip-types scripts/test-receiver-protocol.mjs && node --experimental-strip-types scripts/test-receiver-canvas.mjs && node --experimental-strip-types scripts/test-receiver-session.mjs && node --experimental-strip-types scripts/test-media-plane-characterization.mjs && node --experimental-strip-types scripts/test-vfs-worker.mjs",
|
|
64
64
|
"build": "tsc --noEmit && vite build && vite build --config vite.sdk.config.mjs && vite build --config vite.worker.config.mjs",
|
|
65
65
|
"build:sdk": "tsc --noEmit && vite build --config vite.sdk.config.mjs && vite build --config vite.worker.config.mjs && npm run build:types",
|
|
66
|
+
"build:tv": "tsc --noEmit && node --experimental-strip-types scripts/test-tv-input.mjs && vite build --config vite.tv.config.mjs",
|
|
66
67
|
"build:types": "tsc -p tsconfig.build.json && node scripts/rewrite-declaration-imports.mjs",
|
|
67
68
|
"preview": "vite preview --host 127.0.0.1"
|
|
68
69
|
}
|