Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with hls.stringify for cloned hls object #107

Open
jagadishkamathk opened this issue Aug 2, 2021 · 0 comments
Open

Issue with hls.stringify for cloned hls object #107

jagadishkamathk opened this issue Aug 2, 2021 · 0 comments

Comments

@jagadishkamathk
Copy link

When an HLS object is cloned via JSON.parse(JSON.stringify(manifest)), the resulting object cannot be stringified. The issue lies in

  1. programDateTime field - This gets converted into string. Need to be converted back to Date before stringify
  2. 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);
jagadishkamathk referenced this issue in jagadishkamathk/hls-parser Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant