lib/vtt.js
function(captions) {
        var VTT_BODY = ['WEBVTT\n']; //header
        captions.forEach(function(caption) {
            if (caption.text.length > 0 && validateText(caption.text)) {
                VTT_BODY.push(module.exports.formatTime(caption.startTimeMicro) + ' --> ' + module.exports.formatTime(caption.endTimeMicro));
                VTT_BODY.push(module.exports.renderMacros(caption.text) + '\n');
            }
        });
        return VTT_BODY.join('\n');
    }
function(captions) {
        var VTT_BODY = ['WEBVTT\n']; //header
        captions.forEach(function(caption) {
            if (caption.text.length > 0 && validateText(caption.text)) {
                VTT_BODY.push(module.exports.formatTime(caption.startTimeMicro) + ' --> ' + module.exports.formatTime(caption.endTimeMicro));
                VTT_BODY.push(module.exports.renderMacros(caption.text) + '\n');
            }
        });
        return VTT_BODY.join('\n');
    }
function ( captions ) { var VTT_BODY = [ 'WEBVTT\n' ] ; //header captions . forEach ( function ( caption ) { if ( caption . text . length > 0 && validateText ( caption . text ) ) { VTT_BODY . push ( module . exports . formatTime ( caption . startTimeMicro ) + ' --> ' + module . exports . formatTime ( caption . endTimeMicro ) ) ; VTT_BODY . push ( module . exports . renderMacros ( caption . text ) + '\n' ) ; } } ) ; return VTT_BODY . join ( '\n' ) ; }
Generates VTT from JSON
@function
@param {array} captions - array of json captions
@public
Generates VTT from JSON