Skip to content

Commit

Permalink
Fix #81
Browse files Browse the repository at this point in the history
  • Loading branch information
pluja committed Jan 30, 2024
1 parent 45ff8ec commit 41b5dbd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ export const downloadVTT = function (jsonData, title) {
jsonData.forEach((segment, index) => {
let startSeconds = Math.floor(segment.start);
let startMillis = Math.floor((segment.start - startSeconds) * 1000);
let start = new Date(startSeconds * 1000 + startMillis).toISOString().substr(11, 12).replace('.', ',');
let start = new Date(startSeconds * 1000 + startMillis).toISOString().substr(11, 12);

let endSeconds = Math.floor(segment.end);
let endMillis = Math.floor((segment.end - endSeconds) * 1000);
let end = new Date(endSeconds * 1000 + endMillis).toISOString().substr(11, 12).replace('.', ',');
let end = new Date(endSeconds * 1000 + endMillis).toISOString().substr(11, 12);

vttContent += `${index + 1}\n${start} --> ${end}\n- ${segment.text}\n\n`;
vttContent += `${index + 1}\n${start} --> ${end}\n${segment.text}\n\n`;
});

let vttBlob = new Blob([vttContent], {type: 'text/plain'});
Expand All @@ -118,4 +118,4 @@ export const downloadVTT = function (jsonData, title) {
link.download = `${title}.vtt`;
link.click();
}


0 comments on commit 41b5dbd

Please sign in to comment.