修复超分切换时重复渲染

This commit is contained in:
mtvpls
2025-12-20 21:12:01 +08:00
parent 4a6c2042e4
commit eab3fc9b7f
5 changed files with 18 additions and 13 deletions

View File

@@ -1,7 +1,8 @@
## [203.2.1] - 2025-12-20
## [203.2.2] - 2025-12-20
### Fixed
- 修复IOS端换集报错播放器初始化失败
- 修复超分切换时重复渲染
## [203.2.0] - 2025-12-19

View File

@@ -1 +1 @@
203.2.1
203.2.2

View File

@@ -1059,9 +1059,9 @@ function PlayPageClient() {
};
// 清理播放器资源的统一函数
const cleanupPlayer = () => {
const cleanupPlayer = async () => {
// 先清理Anime4K避免GPU纹理错误
cleanupAnime4K();
await cleanupAnime4K();
if (artPlayerRef.current) {
try {
@@ -1122,8 +1122,10 @@ function PlayPageClient() {
try {
if (anime4kRef.current) {
anime4kRef.current.stop?.();
anime4kRef.current.controller?.stop?.();
anime4kRef.current = null;
// 等待旧实例完全停止,避免双重渲染
await new Promise(resolve => setTimeout(resolve, 100));
}
const video = artPlayerRef.current.video as HTMLVideoElement;
@@ -2925,20 +2927,21 @@ function PlayPageClient() {
}
// WebKit浏览器或首次创建销毁之前的播放器实例并创建新的
if (artPlayerRef.current) {
cleanupPlayer();
}
// 异步初始化播放器
const initPlayer = async () => {
try {
// 先清理旧播放器实例
if (artPlayerRef.current) {
await cleanupPlayer();
}
// iOS需要等待DOM完全清理
await new Promise(resolve => setTimeout(resolve, 100));
// 双重检查:如果旧播放器仍然存在,再次清理
if (artPlayerRef.current) {
console.warn('旧播放器仍存在,再次清理');
cleanupPlayer();
await cleanupPlayer();
await new Promise(resolve => setTimeout(resolve, 100));
}

View File

@@ -11,14 +11,15 @@ export interface ChangelogEntry {
export const changelog: ChangelogEntry[] = [
{
version: '203.2.1',
version: '203.2.2',
date: '2025-12-20',
added: [
],
changed: [
],
fixed: [
"修复IOS端换集报错播放器初始化失败"
"修复IOS端换集报错播放器初始化失败",
"修复超分切换时重复渲染"
]
},{
version: '203.2.0',

View File

@@ -1,6 +1,6 @@
/* eslint-disable no-console */
const CURRENT_VERSION = '203.2.1';
const CURRENT_VERSION = '203.2.2';
// 导出当前版本号供其他地方使用
export { CURRENT_VERSION };