Seek issues fixed
This commit is contained in:
parent
59f3829e27
commit
ddcb71c018
@ -97,7 +97,7 @@ export class SeekStream {
|
|||||||
if (!this.stream.headerparsed) {
|
if (!this.stream.headerparsed) {
|
||||||
const stream = await request_stream(this.url, {
|
const stream = await request_stream(this.url, {
|
||||||
headers: {
|
headers: {
|
||||||
range: `bytes=0-1000`
|
range: `bytes=0-`
|
||||||
}
|
}
|
||||||
}).catch((err: Error) => err);
|
}).catch((err: Error) => err);
|
||||||
|
|
||||||
@ -112,10 +112,12 @@ export class SeekStream {
|
|||||||
this.request = stream;
|
this.request = stream;
|
||||||
stream.pipe(this.stream, { end: false });
|
stream.pipe(this.stream, { end: false });
|
||||||
|
|
||||||
stream.once('end', () => {
|
this.stream.once("headComplete", () => {
|
||||||
this.stream.state = WebmSeekerState.READING_DATA;
|
stream.unpipe(this.stream)
|
||||||
res('');
|
stream.destroy()
|
||||||
});
|
this.stream.state = WebmSeekerState.READING_DATA
|
||||||
|
res('')
|
||||||
|
})
|
||||||
} else res('');
|
} else res('');
|
||||||
}).catch((err) => err);
|
}).catch((err) => err);
|
||||||
if (parse instanceof Error) {
|
if (parse instanceof Error) {
|
||||||
|
|||||||
@ -131,6 +131,11 @@ export class WebmSeeker extends Duplex {
|
|||||||
if (ebmlID.name === 'ebml') this.headfound = true;
|
if (ebmlID.name === 'ebml') this.headfound = true;
|
||||||
else return new Error('Failed to find EBML ID at start of stream.');
|
else return new Error('Failed to find EBML ID at start of stream.');
|
||||||
}
|
}
|
||||||
|
if(ebmlID.name === "cluster") {
|
||||||
|
this.emit("headComplete")
|
||||||
|
this.cursor = this.chunk.length
|
||||||
|
break;
|
||||||
|
}
|
||||||
const data = this.chunk.slice(
|
const data = this.chunk.slice(
|
||||||
this.cursor + this.data_size,
|
this.cursor + this.data_size,
|
||||||
this.cursor + this.data_size + this.data_length
|
this.cursor + this.data_size + this.data_length
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user