Files
MeBox/web/src/utils/withoutVideoFrame.ts
T
truewhile b7f1cd85f8 支持按用户保存播放器与弹幕偏好
在 user 记录上新增播放器音量、弹幕开关、透明度、字号、显示区域、合并偏好、自定义弹幕源以及 dandanplay 应用凭据字段,并提供 PUT /danmaku/settings 局部更新接口,带取值校验。
返回脱敏后的完整渲染配置,绝不回传应用密钥,仅在响应中标记密钥是否已配置。
结果缓存键加入用户 ID 与凭据指纹,避免不同用户或凭据串用缓存;旧版实例级设置仅作为未登录与迁移期的回退。
2026-09-13 23:01:43 +08:00

28 lines
1008 B
TypeScript

/**
* JASSUB probes color space with `new VideoFrame(video)` during construct.
* Direct-play 302s to a CDN / remote Emby taint <video>, and Chrome throws
* SecurityError. Overlay rendering uses requestVideoFrameCallback metadata,
* not pixels, so hide VideoFrame for the sync constructor call.
*
* ponytail: skips color-space matching for all ASS playback, not only tainted
* sources. 302 completes after construct, so we cannot probe currentSrc first.
* Upgrade: canvas-only JASSUB driven by rVFC metadata when the element taints.
*/
export function runWithoutGlobalVideoFrame<T>(fn: () => T): T {
const desc = Object.getOwnPropertyDescriptor(globalThis, 'VideoFrame')
Object.defineProperty(globalThis, 'VideoFrame', {
configurable: true,
writable: true,
value: undefined,
})
try {
return fn()
} finally {
if (desc) {
Object.defineProperty(globalThis, 'VideoFrame', desc)
} else {
delete (globalThis as { VideoFrame?: unknown }).VideoFrame
}
}
}