@video-lab/player-ui 2.0.0 → 3.0.0
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 +10 -1
- package/dist/index.cjs +0 -0
- package/dist/index.d.cts +6 -3
- package/dist/index.d.mts +6 -3
- package/dist/index.mjs +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ export function onPlayerEvent(event: PlayerEvent): void {
|
|
|
51
51
|
|
|
52
52
|
// ③ 重试是 CustomEvent(冒泡),不是回调 prop
|
|
53
53
|
error.addEventListener('sentinel-retry', () => {
|
|
54
|
-
/*
|
|
54
|
+
/* 调用当前句柄的 retry(),由 playablechange 更新显示 */
|
|
55
55
|
})
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -131,3 +131,12 @@ pnpm --filter @video-lab/player-ui test
|
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
Vitest + jsdom,直接测 custom element 的注册 / attribute → DOM / 事件派发。
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### 统一恢复(契约 v2)
|
|
137
|
+
|
|
138
|
+
旧 `reconnect({ resetCounter })` 和 `reconnectstart/success/failed` 已移除。命令入口是 `retry(): Promise<void>`;Promise 完成只表示接受或合并请求。恢复中的重复请求共用预算,强播放证据通过 `recovery` 的 `recovered` 回报。
|
|
139
|
+
|
|
140
|
+
宿主 UI 读取 `playablechange` 的 `playable`、`recoverable`、`action`。`error` 只提供诊断;预算耗尽才给出 `action: 'retry'`,宿主无需按错误原因拼接重试状态。消费组件/iframe 配置 `showErrorOverlay: false` 与 `showLoadingOverlay: false` 控制默认覆盖层;player-ui 本身只负责渲染,不下发媒体命令。静态 iframe URL 没有宿主命令通道,内部按钮仍走同一调度。
|
|
141
|
+
|
|
142
|
+
更多迁移语义见 [ADR-099](../../docs/adr/ADR-099-unified-recovery-contract.md)。
|
package/dist/index.cjs
CHANGED
|
Binary file
|
package/dist/index.d.cts
CHANGED
|
@@ -48,15 +48,15 @@ declare abstract class SentinelOverlayElement extends HTMLElement {
|
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region src/elements/error.d.ts
|
|
50
50
|
/**
|
|
51
|
-
* `<sentinel-error>` ·
|
|
51
|
+
* `<sentinel-error>` · 错误(显隐由组合层消费 playablechange 决定)
|
|
52
52
|
*
|
|
53
53
|
* 对应原 `<ErrorOverlay>`,但**文案解析上移了**(spec § 技术方案 ②):
|
|
54
54
|
* 原版在组件内部做 `messages['error.<CODE>'] → error.message` 的回退,
|
|
55
55
|
* 现在由组合层(`video-react` / embed-app)解析好,元素只收一个 `message` 字符串。
|
|
56
56
|
* `code` 仍然保留 —— 它是给消费方做 `::part()` / 属性选择器和埋点用的。
|
|
57
57
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
58
|
+
* `retryable` 是展示属性,由组合层根据 playablechange.action 为 retry/play 设置;
|
|
59
|
+
* 元素不读取 raw error 的 retryable,也不自行判断恢复预算。
|
|
60
60
|
*
|
|
61
61
|
* 点重试派发 `sentinel-retry`(CustomEvent,冒泡),替代原来的 `onRetry` 回调 prop。
|
|
62
62
|
* 想整块换掉默认 UI,用 `<slot name="retry">`。
|
|
@@ -246,6 +246,9 @@ interface OverlayState {
|
|
|
246
246
|
posterVisible: boolean;
|
|
247
247
|
loadingVisible: boolean;
|
|
248
248
|
error: PlayerError | null;
|
|
249
|
+
diagnostic?: PlayerError;
|
|
250
|
+
action?: 'retry' | 'play' | 'replace-source' | 'recreate-frame' | 'none';
|
|
251
|
+
sessionId?: string;
|
|
249
252
|
/** 暂停图是否显示(契约字段 pauseImage,ADR-043)。`pause` 置起、`play` 撤下 */
|
|
250
253
|
pauseImageVisible: boolean;
|
|
251
254
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -48,15 +48,15 @@ declare abstract class SentinelOverlayElement extends HTMLElement {
|
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region src/elements/error.d.ts
|
|
50
50
|
/**
|
|
51
|
-
* `<sentinel-error>` ·
|
|
51
|
+
* `<sentinel-error>` · 错误(显隐由组合层消费 playablechange 决定)
|
|
52
52
|
*
|
|
53
53
|
* 对应原 `<ErrorOverlay>`,但**文案解析上移了**(spec § 技术方案 ②):
|
|
54
54
|
* 原版在组件内部做 `messages['error.<CODE>'] → error.message` 的回退,
|
|
55
55
|
* 现在由组合层(`video-react` / embed-app)解析好,元素只收一个 `message` 字符串。
|
|
56
56
|
* `code` 仍然保留 —— 它是给消费方做 `::part()` / 属性选择器和埋点用的。
|
|
57
57
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
58
|
+
* `retryable` 是展示属性,由组合层根据 playablechange.action 为 retry/play 设置;
|
|
59
|
+
* 元素不读取 raw error 的 retryable,也不自行判断恢复预算。
|
|
60
60
|
*
|
|
61
61
|
* 点重试派发 `sentinel-retry`(CustomEvent,冒泡),替代原来的 `onRetry` 回调 prop。
|
|
62
62
|
* 想整块换掉默认 UI,用 `<slot name="retry">`。
|
|
@@ -246,6 +246,9 @@ interface OverlayState {
|
|
|
246
246
|
posterVisible: boolean;
|
|
247
247
|
loadingVisible: boolean;
|
|
248
248
|
error: PlayerError | null;
|
|
249
|
+
diagnostic?: PlayerError;
|
|
250
|
+
action?: 'retry' | 'play' | 'replace-source' | 'recreate-frame' | 'none';
|
|
251
|
+
sessionId?: string;
|
|
249
252
|
/** 暂停图是否显示(契约字段 pauseImage,ADR-043)。`pause` 置起、`play` 撤下 */
|
|
250
253
|
pauseImageVisible: boolean;
|
|
251
254
|
/**
|
package/dist/index.mjs
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@video-lab/player-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dist/**/*.css"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@video-lab/protocol": "
|
|
31
|
+
"@video-lab/protocol": "3.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"jsdom": "^24.0.0",
|