mirror of
https://gh-proxy.org/https://github.com/tiajinsha/JKVideo
synced 2026-07-07 23:18:38 +08:00
直播弹幕与界面优化
- useLiveDanmaku: 重写协议解析,支持 zlib 压缩消息、token 认证、base64 帧处理 - services/bilibili: 新增 getLiveDanmakuInfo 获取弹幕服务器信息 - live/[roomId]: 使用真实 roomid 而非 URL 别名连接弹幕 - NativeVideoPlayer: 增加中文注释,移除调试日志 - video/[bvid]: UP主头像移至标题前,调整字号与样式 - index: 替换 logo 文字为下载按钮图标 - videoRows: 修复奇数视频配对,调整 BigRow 位置策略 - package.json: 移除未使用的 fast-xml-parser 和 xml2js 依赖
This commit is contained in:
@@ -39,22 +39,29 @@ export function toListRows(pages: VideoItem[][], liveRooms?: LiveRoom[]): ListRo
|
||||
|
||||
const pairs: (NormalRow | LiveRow)[] = [];
|
||||
for (let i = 0; i < rest.length; i += 2) {
|
||||
pairs.push({ type: 'pair', left: rest[i], right: rest[i + 1] ?? null });
|
||||
if (rest[i + 1]) {
|
||||
pairs.push({ type: 'pair', left: rest[i], right: rest[i + 1] ?? null });
|
||||
}
|
||||
}
|
||||
|
||||
// Inject 1 LiveRow per chunk at a deterministic position (seed = first video aid)
|
||||
if (liveRooms && roomIdx < liveRooms.length && pairs.length > 0) {
|
||||
const seed = chunk[0]?.aid ?? 0;
|
||||
const insertAt = seed % (pairs.length + 1);
|
||||
pairs.splice(insertAt, 0, {
|
||||
type: 'live',
|
||||
left: liveRooms[roomIdx],
|
||||
});
|
||||
roomIdx++;
|
||||
}
|
||||
|
||||
rows.push({ type: 'big', item: bigItem });
|
||||
rows.push(...pairs);
|
||||
|
||||
// if (liveRooms && roomIdx < liveRooms.length && pairs.length > 0) {
|
||||
// const seed = chunk[0]?.aid ?? 0;
|
||||
// const insertAt = seed % (pairs.length + 1);
|
||||
// pairs.splice(insertAt, 0, {
|
||||
// type: 'live',
|
||||
// left: liveRooms[roomIdx],
|
||||
// });
|
||||
// roomIdx++;
|
||||
// }
|
||||
|
||||
|
||||
if (rows.length < 20) {
|
||||
rows.push({ type: 'big', item: bigItem }, ...pairs);
|
||||
} else {
|
||||
rows.push(...pairs, { type: 'big', item: bigItem });
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user