libaribhtml5 0.1.0 → 0.1.2

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.
@@ -6,6 +6,14 @@ export type BroadcastDocumentOptions = {
6
6
  /** Inline bootstrap inserted at the start of head, including its script tag. */
7
7
  bootstrap?: string;
8
8
  };
9
+ /**
10
+ * Bootstrap a receiver-managed document before broadcaster deferred scripts run.
11
+ *
12
+ * A restored iframe can be parsed before the parent application's module has
13
+ * installed its host callback. Keep the receiver identity query usable during
14
+ * that short window and retry the full installation once the parent is ready.
15
+ */
16
+ export declare function createRuntimeBootstrap(scopePath?: string): string;
9
17
  export declare function rewriteBroadcastObjectMarkup(source: string): string;
10
18
  export declare function prefixBroadcastRootAttributes(source: string, basePath?: string, scopePath?: string): string;
11
19
  export declare function prepareBroadcastStylesheet(source: string, options?: BroadcastDocumentOptions): string;
@@ -124,20 +124,24 @@ and therefore follow the Worker route. A font explicitly retained through
124
124
 
125
125
  `src/runtime/fonts/arib-symbols.svg` is the auditable SVG Font source for the
126
126
  television-symbol block `U+1F19B..U+1F1AC`, including `U+1F19E SQUARED FOUR K`
127
- (`🆞`). They are a minimal subset of the OFL-licensed Noto Sans Symbols font
128
- used by the reference receiver. See `src/runtime/fonts/NOTICE.md` and
129
- `src/runtime/fonts/OFL.txt`; no commercial font outline is included.
127
+ (`🆞`). `arib-enclosed-cjk.svg` covers the defined enclosed CJK television
128
+ symbols in `U+1F200..U+1F251`, including `🈑` and `🈔`. They are minimal
129
+ subsets of the OFL-licensed Noto Sans Symbols and Noto Sans CJK JP fonts. See
130
+ `src/runtime/fonts/NOTICE.md` and `src/runtime/fonts/OFL.txt`; no commercial
131
+ font outline is included.
130
132
 
131
133
  Modern browsers no longer reliably render SVG Fonts, so the same script emits
132
- `arib-symbols.woff` for runtime use. The runtime registers the sparse font only
133
- for its 18 code points under `ARIB Symbols` and the ARIB generic family names
134
- `丸ゴシック`, `太丸ゴシック`, and `角ゴシック`. Ordinary Japanese glyphs continue
135
- through the page's next fallback font. Dynamic DRCS and broadcaster-delivered
136
- SVG/WOFF fonts stay separate from this static receiver font.
134
+ the corresponding WOFF files for runtime use. The runtime registers the sparse
135
+ fonts only for those code points under `ARIB Symbols` and the ARIB generic
136
+ family names `丸ゴシック`, `太丸ゴシック`, and `角ゴシック`. Ordinary Japanese
137
+ glyphs continue through the page's next fallback font. Dynamic DRCS and
138
+ broadcaster-delivered SVG/WOFF fonts stay separate from these static receiver
139
+ fonts.
137
140
 
138
141
  Regenerate both assets with:
139
142
 
140
143
  ```sh
141
144
  nix-shell -p python313Packages.fonttools --run \
142
- 'python scripts/build-arib-symbol-font.py /path/to/NotoSansSymbols.ttf'
145
+ 'python scripts/build-arib-symbol-font.py /path/to/NotoSansSymbols.ttf \
146
+ --cjk-source /path/to/NotoSansCJK-VF.otf.ttc'
143
147
  ```
@@ -13,6 +13,47 @@
13
13
  caption ページを正しく表示するなら、1 番目または 2 番目が必要です。
14
14
  `BehindIframeMediaPlaneAdapter` では実現できません。
15
15
 
16
+ ## 背景プレーンの制約
17
+
18
+ BS4K/BS8K の背景は、データ放送ページが任意に選ぶ壁紙ではありません。受信機は
19
+ マルチメディアプレーンより後ろに、画面全体を覆う単色の背景プレーンを持ちます。
20
+ 前面のプレーンが透明、または何も描画していない画素だけに、この色が見えます。
21
+
22
+ MMT の source of truth は LCT です。実装時の優先順位は次の通りです。
23
+
24
+ 1. LCT の `Background_Color_Descriptor` があれば、その RGB 各 8 bit の値を使う。
25
+ 2. LCT の色をまだ受け取っていない間は、アプリケーションが報告した stage の単色を互換
26
+ fallback として使ってよい。ただし、これはアプリケーション CSS を LCT と解釈するものではない。
27
+ 3. どちらも得られない間の receiver-owned fallback は黒 (`#000`) とする。
28
+
29
+ この fallback は規格上の既定色ではありません。白いブラウザ canvas の露出を避けるための
30
+ 実装上の選択です。確認に使った NHK BS8K の `8k.mmts` から抽出したファイルも、
31
+ `top/source/top.css` の `body` と `#vstream`、および
32
+ `caption/source/caption.css` の `#backscreen` と `.bs8k #container` に黒を指定しています。
33
+ したがって、このサンプル用に背景画像やグラデーションを追加しません。
34
+
35
+ 背景の実装には、さらに次の制約があります。
36
+
37
+ - 背景プレーンは viewport 全体を覆い、映像、アプリケーション、字幕、文字スーパーより後ろに置く。
38
+ - LCT の色はアプリケーションやサービスの切り替え時に引き継がない。新しい LCT を受け取るまでは
39
+ fallback に戻す。
40
+ - アプリケーションの `html` / `body` を透明化して映像を見せる場合でも、透明部分の下には
41
+ receiver-owned background plane を残す。
42
+ - 放送アプリケーション内の背景画像、要素背景、半透明 UI は multimedia plane の描画であり、
43
+ LCT の背景色を置き換えない。
44
+ - native compositor でも DOM 実装でも、LCT の単色を iframe 内の装飾要素として実装しない。
45
+ 動画領域の切り抜きや iframe のページ遷移から独立した、受信機所有の最背面レイヤーにする。
46
+
47
+ 根拠は `../ARIB-docs` の次の条項です。
48
+
49
+ - ARIB STD-B62 1.5版 第一編 第1部 5.2(4): 背景プレーンは最背面で、前面が透明または
50
+ 未描画の部分に指定色を表示する。
51
+ - 同 5.3: MMT 方式の受信機は LCT で指定された色を背景プレーンへ描画して合成する。
52
+ - 同 6.1.1: 背景プレーンは 7680x4320、BT.2020 系の RGB 各 8 bit として定義される。
53
+ - ARIB STD-B60 1.5版 7.3.3.3 および 7.4.3.3: LCT と
54
+ `Background_Color_Descriptor` (`descriptor_tag=0x8002`) を定義し、24 bit を RGB 各 8 bit
55
+ の背景色として扱う。
56
+
16
57
  ## ブラウザへ組み込む最小コード
17
58
 
18
59
  普通の動画表示領域とデータ放送 iframe を同じ viewport に置きます。
@@ -22,10 +63,17 @@ caption ページを正しく表示するなら、1 番目または 2 番目が
22
63
  <div id="normal-player">
23
64
  <video id="video" autoplay muted playsinline></video>
24
65
  </div>
25
- <iframe id="broadcast" sandbox="allow-scripts allow-same-origin"></iframe>
66
+ <iframe id="broadcast"></iframe>
26
67
  </div>
27
68
  ```
28
69
 
70
+ この iframe は受信機が管理する同一 origin のコンテンツです。
71
+ `sandbox="allow-scripts allow-same-origin"` は指定しないでください。同一 origin の
72
+ script は sandbox 属性を除去できるため、ブラウザも security boundary にならないと
73
+ 警告します。一方で `allow-same-origin` を外すと、host から受信機 API を導入できません。
74
+ 受信機が信頼しないアプリケーションには、この in-process runtime ではなく別 origin の
75
+ integration が必要です。
76
+
29
77
  `DomObjectMediaPlaneAdapter` に既存の video と、データ放送を終了した時に video を戻す
30
78
  通常プレーヤー container を渡します。
31
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libaribhtml5",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Browser runtime and receiver host for ARIB HTML5 data broadcasting",
5
5
  "keywords": [
6
6
  "arib",