libaribhtml5 0.1.4 → 0.1.5

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 CHANGED
@@ -2,30 +2,54 @@
2
2
 
3
3
  [日本語](#日本語) | [English](#english)
4
4
 
5
+ ## Demo
6
+
7
+ <p align="center">
8
+ <img src="docs/images/bs8k-data-broadcast-home.webp" alt="NHK BS8K data-broadcast home screen" width="100%">
9
+ </p>
10
+ <p align="center">
11
+ <img src="docs/images/bs8k-usage-survey.webp" alt="NHK BS8K data-service usage survey" width="100%">
12
+ </p>
13
+ <p align="center">
14
+ <img src="docs/images/bs8k-caption-dialog.webp" alt="NHK BS8K caption controls" width="100%">
15
+ </p>
16
+ <p align="center">
17
+ <img src="docs/images/bs8k-message-removal.webp" alt="NHK BS8K message-removal guide" width="100%">
18
+ </p>
19
+
5
20
  ## 日本語
6
21
 
7
- ブラウザ上で動作する ARIB HTML5 受信機ランタイムのプロトタイプです。初期デモでは、
8
- 展開済みの BS4K アプリケーションを放送時のパスで配信し、アプリケーションの
9
- スクリプトが実行される前に受信機 API のポリフィルを注入します。
22
+ 本プロジェクトは、Web ブラウザ上で動作する ARIB HTML5 受信機ランタイムの
23
+ プロトタイプです。デモでは、展開済みの BS4K アプリケーションを放送時と同じ
24
+ パス構成で配信し、実行前に受信機 API の互換レイヤーを組み込みます。
10
25
 
11
26
  ```sh
12
27
  pnpm install
13
28
  pnpm dev
14
29
  ```
15
30
 
16
- Vite が出力した URL を開いてください。放送による自動起動アプリケーションには
17
- **透明起動ページ**を、表示ページを直接確認するには**表示ページ**を使用します。
31
+ 起動後、Vite に表示された URL をブラウザで開いてください。放送時と同じ自動起動の
32
+ 流れを試す場合は**透明起動ページ**、画面を直接開く場合は**表示ページ**を選択します。
33
+
34
+ ### 動作確認済みブラウザ
35
+
36
+ - Microsoft Edge `150.0.4078.105`(Chromium ベース)
37
+ - Firefox `153.0`
38
+
39
+ Safari には未解決の互換性問題があるため、現時点では対応していません。
18
40
 
19
41
  ### 注意事項
20
42
 
21
- - 放送アプリケーションが利用する一部のオンラインデータは、ブラウザから放送局の
22
- サーバーへ直接リクエストされます。現在のデモでは、安全のため、このような外部への
23
- ネットワークリクエストをすべてブロックしています。
24
- - ACAS のシリアル番号は `0721 0721 0721 0724 9674` に固定してエミュレートしています。
43
+ - 放送アプリケーションの一部機能は、放送局のサーバー上にあるデータを参照します。
44
+ このデモでは安全のため、ブラウザから外部サーバーへの通信をすべて遮断しています。
45
+ そのため、オンライン連携を前提とする機能は動作しません。
46
+ - 受信機情報として返す ACAS 番号には、デモ用の固定値
47
+ `0721 0721 0721 0724 9674` を使用しています。
25
48
 
26
49
  ### SDK バンドル
27
50
 
28
- npm から利用する場合は、パッケージをインストールして ESM エントリを import します。
51
+ npm パッケージとして利用する場合は、以下のようにインストールし、
52
+ ESM エントリポイントから読み込みます。
29
53
 
30
54
  ```sh
31
55
  npm install libaribhtml5
@@ -35,68 +59,81 @@ npm install libaribhtml5
35
59
  import { AribReceiverHost, installRuntime } from 'libaribhtml5'
36
60
  ```
37
61
 
38
- 従来の `<script>` 向け IIFE は `libaribhtml5/iife`、Service Worker ファイルは
39
- `libaribhtml5/arib-vfs-sw.js` として公開されます。
62
+ `<script>` タグから読み込む IIFE 版は `libaribhtml5/iife`、Service Worker は
63
+ `libaribhtml5/arib-vfs-sw.js` から利用できます。
40
64
 
41
65
  ```sh
42
66
  pnpm build:sdk
43
67
  ```
44
68
 
45
- このコマンドは `dist/sdk/libaribhtml5.js` と、ブラウザ VFS 用の
46
- `dist/sdk/arib-vfs-sw.js` を生成します。SDK は `AribReceiverHost`、
47
- `ServiceWorkerBroadcastVfs`、`installRuntime` を持つ `window.ARIBHTML5` を公開します。受信機内蔵音は
48
- `src/runtime/romsound/` 以下で個別の MP3 ファイルとして管理され、SDK のビルド時に
49
- すべてデータ URL として単一の JavaScript バンドルへ埋め込まれます。
69
+ このコマンドを実行すると、`dist/sdk/libaribhtml5.js` とブラウザ VFS 用の
70
+ `dist/sdk/arib-vfs-sw.js` が生成されます。`window.ARIBHTML5` からは
71
+ `AribReceiverHost`、`ServiceWorkerBroadcastVfs`、`installRuntime` を利用できます。
50
72
 
51
- プレーヤーへ統合する際のメディアスロット、adapter、レイヤー、ライフサイクル、字幕の契約は
73
+ 受信機の内蔵音は `src/runtime/romsound/` 以下で個別の MP3 ファイルとして管理され、
74
+ SDK のビルド時にデータ URL として単一の JavaScript バンドルへ埋め込まれます。
75
+ iOS/iPadOS では、短い内蔵音の再生によって主映像の Media Session が切り替わるのを
76
+ 防ぐため、`romsound://` の再生処理は音を出さずに成功を返します。
77
+
78
+ プレーヤーへ組み込む際のメディアスロット、アダプター、レイヤー構成、
79
+ ライフサイクル、字幕連携については、
52
80
  [メディアプレーン共通統合ガイド](docs/media-plane-integration.md)を参照してください。
53
81
  [ブラウザ iframe 合成の注意事項](docs/browser-iframe-compositing.md)には、Chromium の
54
82
  `color-scheme` backdrop と external media hole の実装条件をまとめています。
55
- データ放送へ入る時は `host.loadApplication()`、通常プレーヤーへ戻す時は
83
+ データ放送を開始する際は `host.loadApplication()`、通常のプレーヤー画面へ戻る際は
56
84
  `host.exitApplication()` を使用します。
57
- MH-AIT の `AUTOSTART` / `PRESENT` / `KILL`、紅白等の連動 application、
58
- `replaceApplication()` と EMT の責務境界は
85
+ MH-AIT の `AUTOSTART` / `PRESENT` / `KILL`、番組連動アプリケーション、
86
+ `replaceApplication()` と EMT の役割分担については、
59
87
  [MH-AIT アプリケーションライフサイクル](docs/application-lifecycle.md)を参照してください。
60
88
 
61
- 録画再生ではシステム時計ではなく、ストリームの NTP と再生位置を
62
- `host.setBroadcastClock()` へ渡します。変換例は
89
+ 録画再生時はシステム時刻ではなく、ストリームの NTP と再生位置を
90
+ `host.setBroadcastClock()` に渡します。時刻の変換例は
63
91
  [録画再生時の放送時計](docs/broadcast-clock.md)を参照してください。
64
92
 
65
- EIT 由来の番組情報と受信機固有情報を host から渡す契約は
66
- [receiver host contracts](docs/receiver-host-contracts.md)を参照してください。
93
+ EIT 由来の番組情報や受信機固有情報をホストから受け渡すインターフェースについては、
94
+ [受信機ホスト契約](docs/receiver-host-contracts.md)を参照してください。
67
95
 
68
96
  Service Worker の `/data-broadcast/` ルーティング、データ放送リソースの
69
- store/update/release ライフサイクル、および ARIB 追加記号フォントは
97
+ 保存・更新・解放の流れ、および ARIB 追加記号フォントについては、
70
98
  [放送リソースとフォント](docs/broadcast-resources-and-fonts.md)を参照してください。
71
99
 
72
- Android/WebView の「放送予定」検索結果から受信機所有の番組表・番組詳細を開く場合は、
73
- [`onOpenProgramGuide` とブラウザ fallback](docs/android-program-guide.md)を参照してください。
100
+ Android/WebView で「放送予定」の検索結果から受信機側の番組表や番組詳細画面を
101
+ 開く場合は、[`onOpenProgramGuide` とブラウザへのフォールバック](docs/android-program-guide.md)を
102
+ 参照してください。
74
103
 
75
104
  ## English
76
105
 
77
- Browser-hosted ARIB HTML5 receiver-runtime prototype. The initial demo serves the
78
- extracted BS4K application under its broadcast path and injects receiver API
79
- polyfills before the application scripts execute.
106
+ libaribhtml5 is a prototype ARIB HTML5 receiver runtime that runs in the browser.
107
+ The demo serves an extracted BS4K application using its original broadcast path
108
+ layout and installs a compatibility layer for the receiver APIs before the
109
+ application starts.
80
110
 
81
111
  ```sh
82
112
  pnpm install
83
113
  pnpm dev
84
114
  ```
85
115
 
86
- Open the URL printed by Vite. Use **透明起動ページ** for the broadcast autostart
87
- application and **表示ページ** to inspect the visible page directly.
116
+ After starting the development server, open the URL shown by Vite. Choose
117
+ **透明起動ページ** to exercise the broadcast autostart flow, or **表示ページ**
118
+ to open the visible application page directly.
119
+
120
+ ### Tested browsers
121
+
122
+ - Microsoft Edge `150.0.4078.105` (Chromium-based)
123
+ - Firefox `153.0`
124
+
125
+ Safari is not currently supported because compatibility issues remain unresolved.
88
126
 
89
127
  ### Notes
90
128
 
91
- - Some online data used by broadcast applications is requested directly from the
92
- browser to the broadcaster's servers. For safety, the current demo blocks all
93
- such external network requests.
94
- - The ACAS serial number is emulated with the fixed value
95
- `0721 0721 0721 0724 9674`.
129
+ - Some broadcast application features fetch data hosted on the broadcaster's
130
+ servers. For safety, this demo blocks all requests to external servers, so
131
+ features that depend on online services will not work.
132
+ - The receiver reports the demo ACAS number `0721 0721 0721 0724 9674`.
96
133
 
97
134
  ### SDK bundle
98
135
 
99
- Install the package to use its typed ESM entry point:
136
+ Install the package and import its typed ESM entry point:
100
137
 
101
138
  ```sh
102
139
  npm install libaribhtml5
@@ -106,26 +143,47 @@ npm install libaribhtml5
106
143
  import { AribReceiverHost, installRuntime } from 'libaribhtml5'
107
144
  ```
108
145
 
109
- The browser-global IIFE remains available as `libaribhtml5/iife`, and the
110
- Service Worker is exported as `libaribhtml5/arib-vfs-sw.js`.
146
+ An IIFE build for `<script>` tags is available as `libaribhtml5/iife`. The
147
+ Service Worker is available as `libaribhtml5/arib-vfs-sw.js`.
111
148
 
112
149
  ```sh
113
150
  pnpm build:sdk
114
151
  ```
115
152
 
116
- This produces `dist/sdk/libaribhtml5.js` plus `dist/sdk/arib-vfs-sw.js` for the
117
- optional browser VFS, and exposes `window.ARIBHTML5` with `AribReceiverHost`,
118
- `ServiceWorkerBroadcastVfs`, and `installRuntime`. Receiver built-in sounds are maintained
119
- as individual MP3 files under `src/runtime/romsound/`; the SDK build inlines all
120
- of them as data URLs in the single JavaScript bundle.
121
-
122
- See the [common media-plane integration guide](docs/media-plane-integration.md)
123
- for the shared video layering, geometry, lifecycle, and caption contract.
124
- See [broadcast resources, Worker routing, and fonts](docs/broadcast-resources-and-fonts.md)
125
- for the `/data-broadcast/` namespace and cache/font lifecycle.
126
- See [Android program-guide integration](docs/android-program-guide.md) for handing a
127
- future-program result to a receiver-owned WebView/native EPG with a browser fallback.
128
- See [receiver host contracts](docs/receiver-host-contracts.md) for program metadata
129
- and receiver-owned system information.
130
- See [MH-AIT application lifecycle](docs/application-lifecycle.md) for AUTOSTART,
131
- PRESENT, KILL, `replaceApplication()`, and the EMT delivery boundary.
153
+ This command produces `dist/sdk/libaribhtml5.js` and
154
+ `dist/sdk/arib-vfs-sw.js` for the browser VFS. The global
155
+ `window.ARIBHTML5` object exposes `AribReceiverHost`,
156
+ `ServiceWorkerBroadcastVfs`, and `installRuntime`.
157
+
158
+ Built-in receiver sounds are stored as individual MP3 files under
159
+ `src/runtime/romsound/`. The SDK build inlines them as data URLs in the
160
+ JavaScript bundle. On iOS and iPadOS, `romsound://` requests succeed without
161
+ playing audio, preventing a short receiver sound from taking over the main
162
+ video's Media Session.
163
+
164
+ The [common media-plane integration guide](docs/media-plane-integration.md)
165
+ covers media slots, adapters, layering, lifecycle management, and caption
166
+ integration. The [browser iframe compositing notes](docs/browser-iframe-compositing.md)
167
+ describe the Chromium `color-scheme` backdrop and the requirements for an
168
+ external media hole.
169
+
170
+ Call `host.loadApplication()` when entering data broadcasting and
171
+ `host.exitApplication()` when returning to the regular player. See
172
+ [MH-AIT application lifecycle](docs/application-lifecycle.md) for `AUTOSTART`,
173
+ `PRESENT`, `KILL`, linked applications, `replaceApplication()`, and the EMT
174
+ delivery boundary.
175
+
176
+ For recorded playback, pass stream-derived NTP time and the current playback
177
+ position to `host.setBroadcastClock()` instead of using the system clock. See
178
+ [broadcast clocks for recorded playback](docs/broadcast-clock.md) for a
179
+ conversion example.
180
+
181
+ See [receiver host contracts](docs/receiver-host-contracts.md) for passing EIT
182
+ program metadata and receiver-specific system information from the host. See
183
+ [broadcast resources, Worker routing, and fonts](docs/broadcast-resources-and-fonts.md)
184
+ for the `/data-broadcast/` namespace, resource lifecycle, and ARIB symbol fonts.
185
+
186
+ For Android/WebView integrations, see
187
+ [`onOpenProgramGuide` and browser fallback](docs/android-program-guide.md) for
188
+ opening the receiver's program guide or program details from a search result
189
+ for an upcoming program.
@@ -6,6 +6,7 @@
6
6
  (_match, _quote, quoted, bare) => ` data-arib-romsound="${quoted ?? bare}"`
7
7
  );
8
8
  }
9
+ const DEFAULT_RECEIVER_DEVICE_IDENTIFIER = "4194c4ae4730";
9
10
  function createRuntimeBootstrap(scopePath = "/data-broadcast/") {
10
11
  const basePath = normalizeBasePath(scopePath);
11
12
  return `<script>
@@ -37,6 +38,9 @@
37
38
  modelname: 'unknown',
38
39
  baseurl: new URL(${JSON.stringify(basePath)}, location.origin).href
39
40
  }
41
+ },
42
+ getDeviceIdentifier: function (kind, callback) {
43
+ queueMicrotask(function () { callback(${JSON.stringify(DEFAULT_RECEIVER_DEVICE_IDENTIFIER)}) })
40
44
  }
41
45
  }
42
46
  })