mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
fix(parser): 这下肯定是最高清晰度了吧
This commit is contained in:
@@ -44,8 +44,22 @@ export function parseMys(data: string): Document {
|
|||||||
const div = document.createElement("div");
|
const div = document.createElement("div");
|
||||||
// 创建视频
|
// 创建视频
|
||||||
const video = document.createElement("video");
|
const video = document.createElement("video");
|
||||||
// 获取 resolutions,将其作为 source
|
// 获取最高分辨率的视频
|
||||||
const resolution = item.insert.vod.resolutions.slice(-1)[0]; // 获取最高分辨率的视频
|
let resolution;
|
||||||
|
// 获取 resolutions中definition="1080P"的视频
|
||||||
|
resolution = item.insert.vod.resolutions.find(
|
||||||
|
(resolution: any) => resolution.definition === "1080P"
|
||||||
|
);
|
||||||
|
if (!resolution) {
|
||||||
|
// 如果没有找到,就获取720P的视频
|
||||||
|
resolution = item.insert.vod.resolutions.find(
|
||||||
|
(resolution: any) => resolution.definition === "720P"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!resolution) {
|
||||||
|
// 如果还是没有找到,就获取第一个
|
||||||
|
resolution = item.insert.vod.resolutions[0];
|
||||||
|
}
|
||||||
// 设置一些属性
|
// 设置一些属性
|
||||||
video.poster = item.insert.vod.cover; // 设置封面
|
video.poster = item.insert.vod.cover; // 设置封面
|
||||||
video.width = resolution.width > 800 ? 800 : resolution.width; // 设置宽度(取最高分辨率的宽度)
|
video.width = resolution.width > 800 ? 800 : resolution.width; // 设置宽度(取最高分辨率的宽度)
|
||||||
|
|||||||
Reference in New Issue
Block a user