From c3c253588cec2c6f898d991e63ea44de13110658 Mon Sep 17 00:00:00 2001 From: jebibot <83044352+jebibot@users.noreply.github.com> Date: Wed, 28 Aug 2024 14:57:57 +0900 Subject: [PATCH] fix: live info --- web/inject.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/web/inject.js b/web/inject.js index b185ba7..3d39056 100644 --- a/web/inject.js +++ b/web/inject.js @@ -715,25 +715,29 @@ let info; try { info = window.__getLiveInfo?.(); - } catch { + } catch {} + try { const selected = Array.from(corePlayer.videoTracks).find( (t) => t.selected ); const tracks = corePlayer.srcObject.data?.media?.find( (m) => (m.mediaId = "LLHLS") )?.encodingTrack; - const track = - tracks?.find((t) => selected.id.includes(t.encodingTrackId)) || - tracks?.find((t) => selected.height === t.videoHeight); - info = { - resolution: `${selected.label}${ - track?.avoidReencoding ? " (원본)" : "" - }`, - bitrate: selected.videoBitrate, - fps: selected.videoFrameRate, - latency: Math.floor(corePlayer.srcObject._getLiveLatency()), - }; - } + const track = tracks?.find( + (t) => t.encodingTrackId === selected.label + ); + if (info == null) { + info = { + resolution: selected.label, + bitrate: selected.videoBitrate, + fps: selected.videoFrameRate, + latency: Math.floor(corePlayer.srcObject._getLiveLatency()), + }; + } + if (track?.avoidReencoding) { + info.resolution += " (원본)"; + } + } catch {} if (info == null) { return; }