Skip to content

Commit 7f16913

Browse files
committed
improve stream end detect
1 parent 18b4625 commit 7f16913

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

npm-shrinkwrap.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "minyami",
3-
"version": "4.4.14",
3+
"version": "4.5.0",
44
"description": "",
55
"main": "dist/exports.js",
66
"types": "dist/exports.d.ts",

src/core/archive.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ class ArchiveDownloader extends Downloader {
8181
*/
8282
async parse() {
8383
// parse m3u8
84-
console.log(this.m3u8);
8584
if (this.m3u8.encryptKeys.length > 0) {
8685
// Encrypted
8786
const key = this.m3u8.encryptKeys[0];

src/core/live.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ export default class LiveDownloader extends Downloader {
6060
this.m3u8 = (await loadM3U8(this.m3u8Path, this.retries, this.timeout)) as Playlist;
6161
} catch (e) {
6262
if (this.finishedChunkCount > 0) {
63-
// Stop downloading
64-
this.isEnd = true;
63+
const responseStatus = e?.response?.status;
64+
if (!!responseStatus && responseStatus >= 400 && responseStatus <= 599) {
65+
logger.info("M3U8 file is no longer available. Stop downloading.");
66+
// Stop downloading
67+
this.isEnd = true;
68+
}
6569
} else {
6670
logger.error("Aborted due to critical error.", e);
6771
this.emit("critical-error", e);

0 commit comments

Comments
 (0)