fix: instant cookie probe, default Auto quality, consistent control order
Build and Push Docker Image / build (push) Successful in 17s
Build and Push Docker Image / build (push) Successful in 17s
- Trigger a stream probe immediately when the upstream cookie field changes, instead of waiting for the next monitor cycle - Remove the probeActive guard in checkLinkRow so a cookie-triggered probe is no longer dropped when it lands while the URL probe is still in flight (the probeToken check already handles superseded results) - Default the HLS resolution menu to its "Auto" (ABR) entry rather than landing on a fixed (lowest) rung; start hls.js in auto level mode - Keep source (视角) selector on the left and resolution on the right in both live and archive players, which previously rendered in opposite order
This commit is contained in:
+6
-1
@@ -3153,7 +3153,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const checkLinkRow = async (row, silent = false) => {
|
const checkLinkRow = async (row, silent = false) => {
|
||||||
if (!row || !row.isConnected || row.dataset.probeActive === '1') return;
|
// Note: no probeActive guard here — a newer check (e.g. triggered by pasting a
|
||||||
|
// cookie while the URL probe is still in flight) must be allowed to start.
|
||||||
|
// The probeToken check below discards any stale/superseded result.
|
||||||
|
if (!row || !row.isConnected) return;
|
||||||
const statusEl = row.querySelector('.stream-check-status');
|
const statusEl = row.querySelector('.stream-check-status');
|
||||||
const { url, type } = getRowProbeTarget(row);
|
const { url, type } = getRowProbeTarget(row);
|
||||||
if (!url) {
|
if (!url) {
|
||||||
@@ -4660,6 +4663,8 @@
|
|||||||
div.querySelector('.l-url').addEventListener('blur', () => scheduleLinkRowCheck(div, 0));
|
div.querySelector('.l-url').addEventListener('blur', () => scheduleLinkRowCheck(div, 0));
|
||||||
div.querySelector('.l-type').addEventListener('change', () => scheduleLinkRowCheck(div, 0));
|
div.querySelector('.l-type').addEventListener('change', () => scheduleLinkRowCheck(div, 0));
|
||||||
div.querySelector('.l-proxy-mode').addEventListener('change', () => scheduleLinkRowCheck(div, 0));
|
div.querySelector('.l-proxy-mode').addEventListener('change', () => scheduleLinkRowCheck(div, 0));
|
||||||
|
div.querySelector('.l-upstream-cookie')?.addEventListener('input', () => scheduleLinkRowCheck(div));
|
||||||
|
div.querySelector('.l-upstream-cookie')?.addEventListener('blur', () => scheduleLinkRowCheck(div, 0));
|
||||||
if (url) scheduleLinkRowCheck(div, 250);
|
if (url) scheduleLinkRowCheck(div, 250);
|
||||||
div.querySelector('.link-move-up')?.addEventListener('click', () => moveLinkRowStep(div, -1));
|
div.querySelector('.link-move-up')?.addEventListener('click', () => moveLinkRowStep(div, -1));
|
||||||
div.querySelector('.link-move-down')?.addEventListener('click', () => moveLinkRowStep(div, 1));
|
div.querySelector('.link-move-down')?.addEventListener('click', () => moveLinkRowStep(div, 1));
|
||||||
|
|||||||
@@ -1302,10 +1302,14 @@
|
|||||||
const hls = new Hls({
|
const hls = new Hls({
|
||||||
enableSoftwareAES: !!keyOverride,
|
enableSoftwareAES: !!keyOverride,
|
||||||
loader: keyOverride ? CustomLoader : Hls.DefaultConfig.loader,
|
loader: keyOverride ? CustomLoader : Hls.DefaultConfig.loader,
|
||||||
|
startLevel: -1,
|
||||||
debug: false
|
debug: false
|
||||||
});
|
});
|
||||||
hls.loadSource(url);
|
hls.loadSource(url);
|
||||||
hls.attachMedia(video);
|
hls.attachMedia(video);
|
||||||
|
// Keep ABR / auto quality active from the start so playback isn't
|
||||||
|
// pinned to the lowest rung when the source (re)loads.
|
||||||
|
hls.on(Hls.Events.MANIFEST_PARSED, () => { hls.currentLevel = -1; });
|
||||||
art.hls = hls;
|
art.hls = hls;
|
||||||
art.on('destroy', () => hls.destroy());
|
art.on('destroy', () => hls.destroy());
|
||||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||||
@@ -1331,6 +1335,28 @@
|
|||||||
},
|
},
|
||||||
plugins: hlsControlPlugins
|
plugins: hlsControlPlugins
|
||||||
});
|
});
|
||||||
|
// The hls-control plugin labels its quality menu from hls.currentLevel, which
|
||||||
|
// is whatever rung hls.js happens to be on when the player becomes ready
|
||||||
|
// (often the lowest). Re-assert auto mode and refresh the menu so the default
|
||||||
|
// selection shows "Auto" rather than the lowest resolution.
|
||||||
|
playerInstance.on('ready', () => {
|
||||||
|
const root = playerInstance.template?.$player;
|
||||||
|
// Default the resolution menu to its "Auto" (ABR) entry instead of a fixed
|
||||||
|
// rung. The plugin tags each entry with data-value; Auto is value -1. Clicking
|
||||||
|
// it runs the plugin's own onSelect, which puts hls.js in auto mode and marks
|
||||||
|
// Auto as the selected item in both the control bar and the settings panel.
|
||||||
|
const autoItem = root?.querySelector('.art-control-hls-quality .art-selector-item[data-value="-1"]');
|
||||||
|
if (autoItem) autoItem.click();
|
||||||
|
// The native source (视角) control and the plugin resolution control get
|
||||||
|
// inserted in opposite DOM order under live vs archive mode, so their
|
||||||
|
// left/right positions flip. Force the archive layout in both: source
|
||||||
|
// selector on the left, resolution on the right.
|
||||||
|
const sourceCtrl = root?.querySelector('.art-control-quality');
|
||||||
|
const resCtrl = root?.querySelector('.art-control-hls-quality');
|
||||||
|
if (sourceCtrl && resCtrl && sourceCtrl.parentNode === resCtrl.parentNode) {
|
||||||
|
resCtrl.parentNode.insertBefore(sourceCtrl, resCtrl);
|
||||||
|
}
|
||||||
|
});
|
||||||
startPlaybackMonitor(data, password);
|
startPlaybackMonitor(data, password);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user