Skip to content

Issue with hls.stringify for cloned hls object #107

Description

@jagadishkamathk

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);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions