1
0
mirror of https://github.com/videojs/video.js.git synced 2025-03-17 21:18:27 +02:00

@gkatsev grouped text track errors in the console, if we can. closes #3259

This commit is contained in:
Gary Katsevman 2016-04-19 17:26:26 -04:00
parent e7d31d3f9e
commit ae4617d74c
2 changed files with 13 additions and 2 deletions

View File

@ -2,7 +2,7 @@ CHANGELOG
=========
## HEAD (Unreleased)
_(none)_
* @gkatsev grouped text track errors in the console, if we can ([view](https://github.com/videojs/video.js/pull/3259))
--------------------

View File

@ -23,13 +23,14 @@ const parseCues = function(srcContent, track) {
let parser = new window.WebVTT.Parser(window,
window.vttjs,
window.WebVTT.StringDecoder());
let errors = [];
parser.oncue = function(cue) {
track.addCue(cue);
};
parser.onparsingerror = function(error) {
log.error(error);
errors.push(error);
};
parser.onflush = function() {
@ -40,6 +41,16 @@ const parseCues = function(srcContent, track) {
};
parser.parse(srcContent);
if (errors.length > 0) {
if (console.groupCollapsed) {
console.groupCollapsed(`Text Track parsing errors for ${track.src}`);
}
errors.forEach((error) => log.error(error));
if (console.groupEnd) {
console.groupEnd();
}
}
parser.flush();
};