超分跨域增强
This commit is contained in:
@@ -741,6 +741,32 @@ function PlayPageClient() {
|
||||
);
|
||||
};
|
||||
|
||||
/** 私人影库类源:配合 moontvplus-extension 跨域媒体模块,供 Anime4K 等读帧 */
|
||||
const needsPrivateSourceCrossOrigin = (source?: string | null) => {
|
||||
if (!source) return false;
|
||||
return (
|
||||
source === 'openlist' ||
|
||||
source === 'xiaoya' ||
|
||||
source === 'emby' ||
|
||||
source.startsWith('emby_')
|
||||
);
|
||||
};
|
||||
|
||||
const applyVideoCrossOrigin = (
|
||||
video: HTMLVideoElement | null,
|
||||
source?: string | null
|
||||
) => {
|
||||
if (!video) return;
|
||||
if (needsPrivateSourceCrossOrigin(source ?? currentSourceRef.current)) {
|
||||
if (video.crossOrigin !== 'anonymous') {
|
||||
video.crossOrigin = 'anonymous';
|
||||
}
|
||||
} else if (video.crossOrigin) {
|
||||
// 切回普通源时去掉,避免无 CORS 的 CDN 在 CORS 模式下播挂
|
||||
video.crossOrigin = null;
|
||||
}
|
||||
};
|
||||
|
||||
const isM3u8LikeUrl = (url?: string) => {
|
||||
if (!url) return false;
|
||||
const normalizedUrl = url.toLowerCase();
|
||||
@@ -3785,6 +3811,9 @@ function PlayPageClient() {
|
||||
// 使用 property 方式也设置一次,确保兼容性
|
||||
(video as any).playsInline = true;
|
||||
(video as any).webkitPlaysInline = true;
|
||||
|
||||
// openlist/emby/xiaoya:CORS 模式加载,需配套「moontvplus 扩展」注入 ACAO 后 Anime4K 才能读帧
|
||||
applyVideoCrossOrigin(video, currentSourceRef.current);
|
||||
};
|
||||
|
||||
// Wake Lock 相关函数
|
||||
@@ -6838,6 +6867,13 @@ function PlayPageClient() {
|
||||
} else {
|
||||
artPlayerRef.current.option.type = '';
|
||||
}
|
||||
// switch 前先对齐 crossOrigin,避免私人影库直链以非 CORS 模式缓存后无法超分
|
||||
if (artPlayerRef.current?.video) {
|
||||
applyVideoCrossOrigin(
|
||||
artPlayerRef.current.video as HTMLVideoElement,
|
||||
currentSourceRef.current
|
||||
);
|
||||
}
|
||||
artPlayerRef.current.switch = videoUrl;
|
||||
artPlayerRef.current.title = `${videoTitle} - ${playerEpisodeLabel}`;
|
||||
artPlayerRef.current.poster = videoCover;
|
||||
@@ -7078,6 +7114,10 @@ function PlayPageClient() {
|
||||
playsInline: true,
|
||||
'webkit-playsinline': 'true',
|
||||
referrerpolicy: 'no-referrer',
|
||||
// 私人影库跨域直链:配合同级 moontvplus-extension 注入 ACAO,供 Anime4K 读帧
|
||||
...(needsPrivateSourceCrossOrigin(currentSourceRef.current)
|
||||
? { crossOrigin: 'anonymous' }
|
||||
: {}),
|
||||
} as any,
|
||||
// HLS 支持配置
|
||||
customType: {
|
||||
|
||||
Reference in New Issue
Block a user