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

code crashes on MS Edge #352

Open
vgrafe opened this issue Sep 26, 2016 · 4 comments
Open

code crashes on MS Edge #352

vgrafe opened this issue Sep 26, 2016 · 4 comments

Comments

@vgrafe
Copy link

vgrafe commented Sep 26, 2016

Hi,

It looks like the WebVTT lib assumes the existence of VTTCue in the window object passed in its constructor (and possibly VTTRegion), but it is not always true, i.e. when importing the lib ES6 style and under MS Edge.

In those conditions, the WebVTT parser internal parse method throws an exception: "Object doesn't support this operation", happening there for VTTCue.

In my scenario, I found a workaround - set VTTCue as a prop on the window object manually:

import { WebVTT, VTTCue } from 'vtt.js'

// the following line needs to happen before injecting the `window` object into the Parser constructor
window.VTTCue = VTTCue;
const parser = new WebVTT.Parser(window, WebVTT.StringDecoder());

// no more error upon parsing!

I'll be happy to submit a PR if needed.

@damoeb
Copy link

damoeb commented Jan 31, 2017

I had the same issue, but window.VTTCue = VTTCue; fixed that error. Your code works fine for me with the newest version 0.13.0.

@dkordik
Copy link

dkordik commented Apr 26, 2018

2018 checking in. just confirming that this is still an issue. but much like those above, I took the quick fix route (which worked, thanks!) and moved on. sorry world. :)

@DwinaTech
Copy link

I had the same issue but with this way now it is working in 0.13.0 version, thank you so match I research too much but finally, it is working 😄 😃

@estrella-accedo
Copy link

2022 and this saved me too. Thank you for sharing this <3

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

5 participants