auto open when detect m3u8
This commit is contained in:
parent
3089ab3b40
commit
c0c69aa0c3
1 changed files with 14 additions and 0 deletions
14
src/index.ts
14
src/index.ts
|
|
@ -250,6 +250,20 @@ function onStreamDetected(url: string, headers?: Record<string, string>): void {
|
|||
|
||||
notifyTopFrame(url, headers);
|
||||
|
||||
if (isTopFrame() && !panel && type === 'm3u8') {
|
||||
panel = createPanel();
|
||||
const cancelBtn = panel.querySelector('.m3u8-dl-cancel-btn') as HTMLButtonElement;
|
||||
if (cancelBtn) {
|
||||
cancelBtn.addEventListener('click', () => {
|
||||
downloadAborted = true;
|
||||
log.info('Download cancelled by user');
|
||||
});
|
||||
}
|
||||
for (const entry of detectedStreams.values()) {
|
||||
addStreamToUI(entry.url, entry.parsed);
|
||||
}
|
||||
}
|
||||
|
||||
if (isTopFrame() && panel) {
|
||||
addStreamToUI(url);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue