Skip to content

Commit

Permalink
Merge pull request #68 from hyperaudio/67-bugfix-duration-undefined
Browse files Browse the repository at this point in the history
bugfix for undefined word start or duration
  • Loading branch information
maboa authored Mar 10, 2021
2 parents ab9c83e + cf544d7 commit 286e69e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion wp-hyperaudio/js/caption.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ var caption = (function () {

var thisStart = parseInt(word.getAttribute("data-m"))/1000;
var thisDuration = parseInt(word.getAttribute("data-d"))/1000;

if (isNaN(thisStart)) {
thisStart = 0;
}

if (isNaN(thisDuration)) {
thisDuration = 0;
}

var thisText = word.innerText;

thisWordMeta = new wordMeta(thisStart, thisDuration, thisText);
Expand Down Expand Up @@ -259,7 +268,7 @@ var caption = (function () {
});

document.getElementById(playerId+'-vtt').setAttribute("src", 'data:text/vtt,'+encodeURIComponent(captionsVtt));
//console.log(captionsVtt);
console.log(captionsVtt);

}

Expand Down

0 comments on commit 286e69e

Please sign in to comment.