修复超分切换时重复渲染

This commit is contained in:
mtvpls
2025-12-20 21:12:44 +08:00
parent 4a6c2042e4
commit eab3fc9b7f
5 changed files with 18 additions and 13 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
## [203.2.1] - 2025-12-20 ## [203.2.2] - 2025-12-20
### Fixed ### Fixed
- 修复IOS端换集报错播放器初始化失败 - 修复IOS端换集报错播放器初始化失败
- 修复超分切换时重复渲染
## [203.2.0] - 2025-12-19 ## [203.2.0] - 2025-12-19
+1 -1
View File
@@ -1 +1 @@
203.2.1 203.2.2
+11 -8
View File
@@ -1059,9 +1059,9 @@ function PlayPageClient() {
}; };
// 清理播放器资源的统一函数 // 清理播放器资源的统一函数
const cleanupPlayer = () => { const cleanupPlayer = async () => {
// 先清理Anime4K,避免GPU纹理错误 // 先清理Anime4K,避免GPU纹理错误
cleanupAnime4K(); await cleanupAnime4K();
if (artPlayerRef.current) { if (artPlayerRef.current) {
try { try {
@@ -1122,8 +1122,10 @@ function PlayPageClient() {
try { try {
if (anime4kRef.current) { if (anime4kRef.current) {
anime4kRef.current.stop?.(); anime4kRef.current.controller?.stop?.();
anime4kRef.current = null; anime4kRef.current = null;
// 等待旧实例完全停止,避免双重渲染
await new Promise(resolve => setTimeout(resolve, 100));
} }
const video = artPlayerRef.current.video as HTMLVideoElement; const video = artPlayerRef.current.video as HTMLVideoElement;
@@ -2925,20 +2927,21 @@ function PlayPageClient() {
} }
// WebKit浏览器或首次创建:销毁之前的播放器实例并创建新的 // WebKit浏览器或首次创建:销毁之前的播放器实例并创建新的
if (artPlayerRef.current) {
cleanupPlayer();
}
// 异步初始化播放器 // 异步初始化播放器
const initPlayer = async () => { const initPlayer = async () => {
try { try {
// 先清理旧播放器实例
if (artPlayerRef.current) {
await cleanupPlayer();
}
// iOS需要等待DOM完全清理 // iOS需要等待DOM完全清理
await new Promise(resolve => setTimeout(resolve, 100)); await new Promise(resolve => setTimeout(resolve, 100));
// 双重检查:如果旧播放器仍然存在,再次清理 // 双重检查:如果旧播放器仍然存在,再次清理
if (artPlayerRef.current) { if (artPlayerRef.current) {
console.warn('旧播放器仍存在,再次清理'); console.warn('旧播放器仍存在,再次清理');
cleanupPlayer(); await cleanupPlayer();
await new Promise(resolve => setTimeout(resolve, 100)); await new Promise(resolve => setTimeout(resolve, 100));
} }
+3 -2
View File
@@ -11,14 +11,15 @@ export interface ChangelogEntry {
export const changelog: ChangelogEntry[] = [ export const changelog: ChangelogEntry[] = [
{ {
version: '203.2.1', version: '203.2.2',
date: '2025-12-20', date: '2025-12-20',
added: [ added: [
], ],
changed: [ changed: [
], ],
fixed: [ fixed: [
"修复IOS端换集报错播放器初始化失败" "修复IOS端换集报错播放器初始化失败",
"修复超分切换时重复渲染"
] ]
},{ },{
version: '203.2.0', version: '203.2.0',
+1 -1
View File
@@ -1,6 +1,6 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
const CURRENT_VERSION = '203.2.1'; const CURRENT_VERSION = '203.2.2';
// 导出当前版本号供其他地方使用 // 导出当前版本号供其他地方使用
export { CURRENT_VERSION }; export { CURRENT_VERSION };