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

Failed to execute 'decode' on 'TextDecoder' #366

Open
imerkle opened this issue Jul 16, 2017 · 0 comments
Open

Failed to execute 'decode' on 'TextDecoder' #366

imerkle opened this issue Jul 16, 2017 · 0 comments

Comments

@imerkle
Copy link

imerkle commented Jul 16, 2017

vtt.js:1105 Uncaught TypeError: Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'
at WebVTT.Parser.parse (vtt.js:1105)


WEBVTT FILE

00:00:04.000 --> 00:00:10.000
4 to 10 seconds im show#xywh=0$^0$^167$^94

00:00:10.004 --> 00:00:16.008
10 to 16 seconds im show#xywh=167$^0$^167$^94


00:00:15.004 --> 00:00:21.000
15 to 21 seconds im show#xywh=167$^0$^167$^94
import v from 'vtt.js';
const getVttCues = (url, callback) => {
  const parser = new v.WebVTT.Parser(window, v.WebVTT.StringDecoder());
  let vtt,
    cues = [];   
  const xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
      if (this.readyState == 4 && this.status == 200) {
        vtt = xhttp.responseText;
        console.log(vtt);
        parser.oncue = function(cue) {
          cues.push(cue);
        };
        parser.parse(vtt);
        parser.flush();
        callback(cues);
        
        
      }
  };

What weird is I tried in webpackbin it works.!!

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