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

Spaces being added in meta header #135

Open
EricAveritt opened this issue Sep 1, 2022 · 0 comments
Open

Spaces being added in meta header #135

EricAveritt opened this issue Sep 1, 2022 · 0 comments

Comments

@EricAveritt
Copy link

EricAveritt commented Sep 1, 2022

Currently we are using video.js and exoplayer for some devices to play our content and are using node-webvtt version "^1.9.4"
Our current .vtt files have a meta header that looks like this:

WEBVTT
X-TIMESTAMP-MAP=MPEGTS:183750,LOCAL:00:00:00.000

However after running our .vtt file through the compile() method, we are noticing that a space is being added after the semicolon in the meta header.

WEBVTT
X-TIMESTAMP-MAP=MPEGTS: 183750,LOCAL:00:00:00.000

This is causing video.js and exoplayer to have issues loading captions due to an error with X-TIMESTAMP-MAP and the caption files are not being displayed.

Looking in the compiler.js, I noticed this section of code which deliberately adds a space to the output:

if (input.meta) {
    if (typeof input.meta !== 'object' || Array.isArray(input.meta)) {
      throw new CompilerError('Metadata must be an object');
    }

    Object.entries(input.meta).forEach((i) => {
      if (typeof i[1] !== 'string') {
        throw new CompilerError(`Metadata value for "${i[0]}" must be string`);
      }

      output += `${i[0]}: ${i[1]}\n`;
    });
  }

(https://github.com/osk/node-webvtt/blob/master/lib/compiler.js#L44)
And I am wondering what the reasoning is behind adding that space there in the output section?
Some players handle it correctly but not every player does and by removing that space both video.js and exoplayer were able to render the caption correctly and have it displayed.

Would it be possible to get this space removed in the meta if block?

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