2
2
3
3
/**
4
4
* @license Copyright (c) 2015-2018 Radiant Media Player
5
- * rmp-create-vtt-thumbnails 0.1.1 | https://github.com/radiantmediaplayer/rmp-create-vtt-thumbnails
5
+ * rmp-create-vtt-thumbnails 0.1.2 | https://github.com/radiantmediaplayer/rmp-create-vtt-thumbnails
6
6
*/
7
7
8
8
'use strict' ;
@@ -11,7 +11,7 @@ const fs = require('fs');
11
11
const eol = require ( 'os' ) . EOL ;
12
12
13
13
// function to append data to our output VTT file
14
- var _appendFileSync = function ( file , data ) {
14
+ const _appendFileSync = function ( file , data ) {
15
15
try {
16
16
fs . appendFileSync ( file , data ) ;
17
17
} catch ( err ) {
@@ -21,7 +21,7 @@ var _appendFileSync = function (file, data) {
21
21
22
22
// function to convert second-based time to HH:MM:SS.xxxx format required for VTT compliance
23
23
// see https://www.w3.org/TR/webvtt1/#webvtt-timestamp
24
- var _secondsToHRTime = function ( time ) {
24
+ const _secondsToHRTime = function ( time ) {
25
25
if ( typeof time === 'number' && time >= 0 ) {
26
26
let seconds = Math . floor ( time % 60 ) ;
27
27
let minutes = Math . floor ( time * 1.0 / 60 ) ;
@@ -52,13 +52,13 @@ var _secondsToHRTime = function (time) {
52
52
// parsing input from our command line
53
53
// input params are: duration spriteFileLocation outputVTTFileName gapBetweenFrames thumbnailWidth thumbnailHeight tileSize
54
54
// example: node create.js 596 assets/bbb-sprite.jpg output/bbb-thumbnails.vtt 5 128 72 11
55
- var duration ;
56
- var spriteFileLocation ;
57
- var outputVTTFileName ;
58
- var gapBetweenFrames ;
59
- var thumbnailWidth ;
60
- var thumbnailHeight ;
61
- var tileSize ;
55
+ let duration ;
56
+ let spriteFileLocation ;
57
+ let outputVTTFileName ;
58
+ let gapBetweenFrames ;
59
+ let thumbnailWidth ;
60
+ let thumbnailHeight ;
61
+ let tileSize ;
62
62
process . argv . forEach ( ( value , index ) => {
63
63
switch ( index ) {
64
64
case 2 :
@@ -104,12 +104,12 @@ try {
104
104
}
105
105
106
106
// append our initial VTT data for spec compliance
107
- var initialData = 'WEBVTT' + eol + eol ;
107
+ const initialData = 'WEBVTT' + eol + eol ;
108
108
_appendFileSync ( outputVTTFileName , initialData ) ;
109
109
110
110
// initial variables values for our loop
111
- var itemNumber = Math . floor ( duration / gapBetweenFrames ) + 1 ;
112
- var currentTime = 0 ;
111
+ const itemNumber = Math . floor ( duration / gapBetweenFrames ) + 1 ;
112
+ let currentTime = 0 ;
113
113
let xCoordinates = 0 ;
114
114
let yCoordinates = 0 ;
115
115
let thumbnailSizeString = ',' + thumbnailWidth + ',' + thumbnailHeight + eol + eol ;
0 commit comments