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

Safari 10.1 throws Error: The provided value is non-finite #364

Open
ChristiaanScheermeijer opened this issue Apr 13, 2017 · 16 comments
Open

Comments

@ChristiaanScheermeijer
Copy link

When using vtt.js in Safari it throws Error: The provided value is non-finite on this part cue.line = settings.get("line", "auto");.

I think this is an issue in the Safari VTTCue implementation, but I hope to find a workaround in this polyfill.

Below the stacktrace:

consumeCueSettings@http://localhost:9000/bower_components/vtt.js/lib/vtt.js:269:10
parseCue@http://localhost:9000/bower_components/vtt.js/lib/vtt.js:303:23
parse@http://localhost:9000/bower_components/vtt.js/lib/vtt.js:1268:23
  • macOS Sierra 10.12.4
  • Safari Version 10.1 (12603.1.30.0.34)
@ChristiaanScheermeijer ChristiaanScheermeijer changed the title Safari 10.1 throws error on cue.line = 'auto' and cue.position = 'auto' Safari 10.1 throws Error: The provided value is non-finite Apr 13, 2017
@johnBartos
Copy link
Contributor

Here's what we do in jwplayer:

var line = settings.get('line', 'auto');
if (line === 'auto' && defaults.line === -1) {
    // set numeric line number for Safari
    line = -1;
}
cue.line = line;

@aligon
Copy link

aligon commented Apr 20, 2017

Here's how we worked around it:

const oldVTTCue = global.VTTCue;

try {
    global.VTTCue = VTTCue;

    parser.parse(vtt);
    parser.flush();
} finally {
    global.VTTCue = oldVTTCue;
}

The VTTCue in scope is the one from vtt.js

@jsg2021
Copy link

jsg2021 commented Apr 20, 2017

The spec clearly allows for 'auto' :|
https://w3c.github.io/webvtt/#webvtt-cue-line

Apple's native VTTCue is not spec compliant.

@ChristiaanScheermeijer
Copy link
Author

ChristiaanScheermeijer commented Apr 20, 2017 via email

jsg2021 added a commit to jsg2021/vtt.js that referenced this issue Apr 20, 2017
Use the default value for line if set, otherwise use 'auto'.
@ChristiaanScheermeijer
Copy link
Author

Thanks, cue.position also throws this error.

@jsg2021
Copy link

jsg2021 commented Apr 20, 2017

I added position to my PR

@jsg2021
Copy link

jsg2021 commented Apr 20, 2017

Apparently the travis build failed with that change... :/ position wasn't 'auto'?

@jsg2021
Copy link

jsg2021 commented Apr 20, 2017

Ugh... apparently that breaks the tests. cue.position is auto by default (in chrome & ff...in safari its 50) and I'm just using the default if set... and falling back to what was there... :/

@ChristiaanScheermeijer
Copy link
Author

Im using cue.line !== "auto" ? cue.line : "auto" for line and position which seem to work. Not sure if they pass the test though.

@jsg2021
Copy link

jsg2021 commented Apr 20, 2017

This is not really resolved yet...

@jsg2021
Copy link

jsg2021 commented Apr 20, 2017

my PR should fix it

@ChristiaanScheermeijer
Copy link
Author

Oops wrong button!

@ondrejpar
Copy link

Hi, is there any progress on this? Or maybe a workaround?

@jsg2021
Copy link

jsg2021 commented Oct 16, 2017

Just waiting for the pr to be merged.

@Decad
Copy link

Decad commented Nov 24, 2019

We are still getting this issue in Safari 13.0.3 (15608.3.10.1.4). Any news on the PR being merged?

@gkatsev
Copy link
Contributor

gkatsev commented Nov 25, 2019

I believe this is fixed or will soon (in the next release) be fixed in the videojs fork of vtt.js. It's probably the only currently maintained version of vtt.js: https://github.com/videojs/vtt.js (videojs-vtt.js on npm)

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

7 participants