-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
When an HLS object is cloned via JSON.parse(JSON.stringify(manifest)), the resulting object cannot be stringified. The issue lies in
- programDateTime field - This gets converted into string. Need to be converted back to Date before stringify
- IV - The buffer gets converted to object. Should be converted back to buffer before stringify
It would be great if the stringify function can handle this internally more efficiently
Here is the sample code to demonstrate this
const hls = require("hls-parser")
var input = "#EXTM3U \n" +
"#EXT-X-VERSION:5 \n" +
"#EXT-X-MEDIA-SEQUENCE:0 \n" +
"#EXT-X-TARGETDURATION:4 \n" +
"#EXT-X-PROGRAM-DATE-TIME:2021-08-02T07:24:22.997000+00:00 \n" +
"#EXT-X-KEY:METHOD=AES-128,URI=\"enc.key\"" + ",IV=0x0000000000000000000000000000044A \n" +
"#EXTINF:4, \n" +
"0.ts \n" +
"#EXTINF:4, \n" +
"1.ts \n" +
"#EXTINF:4, \n" +
"2.ts";
var manifest = hls.parse(input);
var manifest2 = JSON.parse(JSON.stringify(manifest));
var output = hls.stringify(manifest2);
Metadata
Metadata
Assignees
Labels
No labels