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);
}
};
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)
What weird is I tried in webpackbin it works.!!