尝试修复换集报错

This commit is contained in:
mtvpls
2025-12-20 01:25:38 +08:00
parent 727d74bbf5
commit 242fa6c847
5 changed files with 35 additions and 3 deletions

View File

@@ -1,3 +1,8 @@
## [203.2.1] - 2025-12-20
### Fixed
- 修复IOS端换集报错播放器初始化失败
## [203.2.0] - 2025-12-19
### Added

View File

@@ -1 +1 @@
203.2.0
203.2.1

View File

@@ -1067,7 +1067,7 @@ function PlayPageClient() {
// 获取当前弹幕设置的快照,避免循环引用
const currentDanmakuSettings = danmakuSettingsRef.current;
const danmakuPluginOption = danmakuPluginRef.current.option;
const currentSettings = {
...currentDanmakuSettings,
opacity: danmakuPluginOption.opacity || currentDanmakuSettings.opacity,
@@ -1093,10 +1093,19 @@ function PlayPageClient() {
artPlayerRef.current.destroy();
artPlayerRef.current = null;
// 清空 DOM 容器,确保没有残留元素
if (artRef.current) {
artRef.current.innerHTML = '';
}
console.log('播放器资源已清理');
} catch (err) {
console.warn('清理播放器资源时出错:', err);
artPlayerRef.current = null;
// 即使出错也要清空容器
if (artRef.current) {
artRef.current.innerHTML = '';
}
}
}
};
@@ -2920,6 +2929,14 @@ function PlayPageClient() {
// 异步初始化播放器
const initPlayer = async () => {
try {
// iOS需要等待DOM完全清理
await new Promise(resolve => setTimeout(resolve, 100));
// 再次确保容器为空
if (artRef.current) {
artRef.current.innerHTML = '';
}
// 动态导入播放器库
const [ArtplayerModule, HlsModule, DanmukuPlugin] = await Promise.all([
import('artplayer'),

View File

@@ -11,6 +11,16 @@ export interface ChangelogEntry {
export const changelog: ChangelogEntry[] = [
{
version: '203.2.1',
date: '2025-12-20',
added: [
],
changed: [
],
fixed: [
"修复IOS端换集报错播放器初始化失败"
]
},{
version: '203.2.0',
date: '2025-12-19',
added: [

View File

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