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

Trim parsed input group keys to remove whitespace #60

Merged
merged 2 commits into from
Aug 16, 2022

Conversation

eban5
Copy link
Contributor

@eban5 eban5 commented Jul 14, 2022

This PR introduces a minor adjustment to the keys parsed from each input group in lib/parser/parseOptions.js. This change will fix an issue first reported in videojs/http-streaming#982.

Our video asset caption VTT files were generated in such a way that added an extra whitespace between the first group delimiter (,) and the key "LOCAL" (example below). This extra whitespace, while apparently in-compliance with the HLS-segmented VTT spec, causes VTT.js's parseOptions function to not properly parse cues from the VTT files, resulting in empty text tracks being attached to our player.

Example

WORKING:

X-TIMESTAMP-MAP=MPEGTS:187507,LOCAL:00:00:00.000

BROKEN:

X-TIMESTAMP-MAP=MPEGTS:187507, LOCAL:00:00:00.000

@eban5
Copy link
Contributor Author

eban5 commented Jul 21, 2022

Any thoughts on this small change?

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, been busy to review this. We'll also probably need to figure out releasing. The main branch has a lot of changes that has diverged a lot from what Video.js expects. I'll probably release from a branch when this gets merged in.

@@ -10,7 +10,7 @@ function parseOptions(input, callback, keyValueDelim, groupDelim) {
if (kv.length !== 2) {
continue;
}
var k = kv[0];
var k = kv[0].trim();
var v = kv[1];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a trim here too, just in case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look! Pushed up that change here.

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. I'll refrain from merging until I find a time to do a release. Unfortunately, it's unlikely to get in before August at this point. I'm off next week.

@misteroneill misteroneill merged commit 2eb1ea4 into videojs:main Aug 16, 2022
@bcolflesh
Copy link

Did this make it into version 7.x yet? It's not trimmed in the online tester for 7.x:

https://videojs-http-streaming.netlify.app/

@gkatsev
Copy link
Member

gkatsev commented Oct 20, 2022

It's in 7.20.3 https://github.com/videojs/video.js/releases/tag/v7.20.3
Looks like that page has an out-of-date version of Video.js.

@bcolflesh
Copy link

Gotcha, thanks gkatsev!

@gkatsev
Copy link
Member

gkatsev commented Oct 20, 2022

Just updated the version of video.js there (videojs/http-streaming#1340) it should be deployed in a few minutes.

@bcolflesh
Copy link

Thanks again!

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

Successfully merging this pull request may close these issues.

4 participants