@vidispine/vdt-js 22.2.0 → 22.3.0-pre.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -923,27 +923,28 @@ var parseHighlightTimespanList = function parseHighlightTimespanList() {
923
923
  }, {});
924
924
  };
925
925
 
926
- var _CONSTANT_TIMEBASES;
927
-
928
- var PAL = 'PAL';
929
- var NTSC = 'NTSC';
930
- var NTSC30 = 'NTSC30';
931
- var CONSTANT_TIMEBASES = (_CONSTANT_TIMEBASES = {}, _defineProperty__default["default"](_CONSTANT_TIMEBASES, PAL, {
932
- denominator: 25,
933
- numerator: 1
934
- }), _defineProperty__default["default"](_CONSTANT_TIMEBASES, NTSC, {
935
- denominator: 30000,
936
- numerator: 1001
937
- }), _defineProperty__default["default"](_CONSTANT_TIMEBASES, NTSC30, {
938
- denominator: 30,
939
- numerator: 1
940
- }), _defineProperty__default["default"](_CONSTANT_TIMEBASES, 29.97, {
941
- denominator: 30000,
942
- numerator: 1001
943
- }), _defineProperty__default["default"](_CONSTANT_TIMEBASES, 59.94, {
944
- denominator: 60000,
945
- numerator: 1001
946
- }), _CONSTANT_TIMEBASES);
926
+ var CONSTANT_TIMEBASES = {
927
+ PAL: {
928
+ denominator: 25,
929
+ numerator: 1
930
+ },
931
+ NTSC: {
932
+ denominator: 30000,
933
+ numerator: 1001
934
+ },
935
+ NTSC30: {
936
+ denominator: 30,
937
+ numerator: 1
938
+ },
939
+ 29.97: {
940
+ denominator: 30000,
941
+ numerator: 1001
942
+ },
943
+ 59.94: {
944
+ denominator: 60000,
945
+ numerator: 1001
946
+ }
947
+ };
947
948
  var FRAME_SEPARATORS = {
948
949
  ':': {
949
950
  dropFrame: false,
@@ -963,96 +964,13 @@ var FRAME_SEPARATORS = {
963
964
  }
964
965
  };
965
966
 
966
- function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
967
-
968
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
969
-
970
- var splitSmpte = function splitSmpte(smpteText) {
971
- var hasDropFrameSeparator = smpteText.match(/[^0-9:\-_]/);
972
- var hhmmssff;
973
- var frameOptions = {};
974
-
975
- if (hasDropFrameSeparator) {
976
- var _hasDropFrameSeparato = _slicedToArray__default["default"](hasDropFrameSeparator, 1),
977
- frameSeparator = _hasDropFrameSeparato[0];
978
-
979
- var _smpteText$split = smpteText.split(frameSeparator),
980
- _smpteText$split2 = _slicedToArray__default["default"](_smpteText$split, 2),
981
- hhmmss = _smpteText$split2[0],
982
- splitFrames = _smpteText$split2[1];
983
-
984
- hhmmssff = [].concat(_toConsumableArray__default["default"](hhmmss.split(':')), [splitFrames]);
985
- frameOptions = FRAME_SEPARATORS[frameSeparator] || {};
986
- } else {
987
- hhmmssff = smpteText.split(':');
988
- }
989
-
990
- hhmmssff = hhmmssff.map(Number);
991
-
992
- if (hhmmssff.length > 4 || hhmmssff.some(function (n) {
993
- return Number.isNaN(n);
994
- })) {
995
- throw new Error('Invalid SMPTE timecode');
996
- }
997
-
998
- return [hhmmssff, frameOptions];
999
- };
1000
-
1001
- var getDropFrames = function getDropFrames(roundedFrameRate) {
1002
- return roundedFrameRate === 60 ? 4 : 2;
1003
- };
1004
-
1005
- var getRoundedFrameRate = function getRoundedFrameRate(timeBase) {
1006
- return Math.round(timeBase.denominator / timeBase.numerator);
1007
- };
1008
-
1009
- var countSamples = function countSamples(hh, mm, ss, ff, _ref) {
1010
- var dropFrame = _ref.dropFrame,
1011
- roundedFrameRate = _ref.roundedFrameRate;
1012
-
1013
- if (!dropFrame) {
1014
- return hh * 3600 * roundedFrameRate + mm * 60 * roundedFrameRate + ss * roundedFrameRate + ff;
1015
- }
1016
-
1017
- if (![30, 60].includes(roundedFrameRate)) {
1018
- throw new Error('Cannot use dropframe with non NTSC timebase');
1019
- }
1020
-
1021
- var dropFrames = getDropFrames(roundedFrameRate);
1022
- var shouldDropMinute = mm % 10 !== 0;
1023
- var shouldDropSecond = shouldDropMinute && ss === 0;
1024
- var hourFrames = hh * (3600 * roundedFrameRate - 54 * dropFrames);
1025
- var minuteFrames = mm * 60 * roundedFrameRate - (mm - Math.ceil(mm / 10)) * dropFrames;
1026
- var secondFrames = ss * roundedFrameRate - (shouldDropMinute && ss > 1 ? dropFrames : 0);
1027
-
1028
- if (shouldDropSecond && ff < dropFrames) {
1029
- throw new Error('Invalid ff');
1030
- }
1031
-
1032
- var frameFrames = shouldDropSecond ? ff - dropFrames : ff;
1033
- return hourFrames + minuteFrames + secondFrames + frameFrames;
1034
- };
1035
-
1036
- function countDroppedFrames(frames, roundedFrameRate) {
1037
- var dropFrames = getDropFrames(roundedFrameRate);
1038
- var oneMinuteUndroppedFrames = 60 * roundedFrameRate;
1039
- var oneMinuteDroppedFrames = 60 * roundedFrameRate - dropFrames;
1040
- var tenMinuteFrames = 10 * (oneMinuteUndroppedFrames - dropFrames) + dropFrames;
1041
- var tenMinuteChunks = Math.floor(frames / tenMinuteFrames);
1042
- var minuteRemainder = Math.max(0, frames % tenMinuteFrames - oneMinuteUndroppedFrames);
1043
- var oneMinuteChunks = Math.floor(minuteRemainder / oneMinuteDroppedFrames);
1044
- var frameRemainder = minuteRemainder % oneMinuteDroppedFrames;
1045
- var frameChunks = frameRemainder > 0 ? dropFrames : 0;
1046
- return tenMinuteChunks * 9 * dropFrames + oneMinuteChunks * dropFrames + frameChunks;
1047
- }
1048
-
1049
967
  var TimeBase = /*#__PURE__*/function () {
1050
968
  function TimeBase() {
1051
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1052
- _ref2$numerator = _ref2.numerator,
1053
- numerator = _ref2$numerator === void 0 ? 1 : _ref2$numerator,
1054
- _ref2$denominator = _ref2.denominator,
1055
- denominator = _ref2$denominator === void 0 ? 1 : _ref2$denominator;
969
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
970
+ _ref$numerator = _ref.numerator,
971
+ numerator = _ref$numerator === void 0 ? 1 : _ref$numerator,
972
+ _ref$denominator = _ref.denominator,
973
+ denominator = _ref$denominator === void 0 ? 1 : _ref$denominator;
1056
974
 
1057
975
  _classCallCheck__default["default"](this, TimeBase);
1058
976
 
@@ -1136,23 +1054,94 @@ var TimeBase = /*#__PURE__*/function () {
1136
1054
  return TimeBase;
1137
1055
  }();
1138
1056
 
1139
- var isDropFrameTimeBase = function isDropFrameTimeBase(_ref3) {
1140
- var numerator = _ref3.numerator,
1141
- denominator = _ref3.denominator;
1057
+ var formatTimeBaseType = function formatTimeBaseType(timeBase) {
1058
+ return new TimeBase(timeBase);
1059
+ };
1060
+
1061
+ var formatTimeBaseText = function formatTimeBaseText(timeBaseText) {
1062
+ if (timeBaseText === undefined) {
1063
+ return formatTimeBaseType();
1064
+ }
1065
+
1066
+ if (typeof timeBaseText === 'number') {
1067
+ return formatTimeBaseType({
1068
+ denominator: timeBaseText
1069
+ });
1070
+ }
1071
+
1072
+ if (timeBaseText.includes(':')) {
1073
+ var _timeBaseText$split = timeBaseText.split(':'),
1074
+ _timeBaseText$split2 = _slicedToArray__default["default"](_timeBaseText$split, 2),
1075
+ _denominator = _timeBaseText$split2[0],
1076
+ numerator = _timeBaseText$split2[1];
1077
+
1078
+ return formatTimeBaseType({
1079
+ denominator: _denominator,
1080
+ numerator: numerator
1081
+ });
1082
+ }
1083
+
1084
+ if (Object.keys(CONSTANT_TIMEBASES).includes(timeBaseText)) {
1085
+ return formatTimeBaseType(CONSTANT_TIMEBASES[timeBaseText]);
1086
+ }
1087
+
1088
+ var denominator = Number(timeBaseText);
1089
+
1090
+ if (Number.isNaN(denominator)) {
1091
+ throw new Error("timeBaseText must be a number or ".concat(Object.keys(CONSTANT_TIMEBASES).join(','), " - is ").concat(timeBaseText));
1092
+ }
1093
+
1094
+ return formatTimeBaseType({
1095
+ denominator: denominator
1096
+ });
1097
+ };
1098
+
1099
+ var formatTimeBase = function formatTimeBase(timeBase) {
1100
+ if (_typeof__default["default"](timeBase) === 'object') {
1101
+ return formatTimeBaseType(timeBase);
1102
+ }
1103
+
1104
+ return formatTimeBaseText(timeBase);
1105
+ };
1106
+
1107
+ var getDropFrames$1 = function getDropFrames(roundedFrameRate) {
1108
+ return roundedFrameRate === 60 ? 4 : 2;
1109
+ };
1110
+
1111
+ var getRoundedFrameRate$1 = function getRoundedFrameRate(timeBase) {
1112
+ return Math.round(timeBase.denominator / timeBase.numerator);
1113
+ };
1114
+
1115
+ function countDroppedFrames(frames, roundedFrameRate) {
1116
+ var dropFrames = getDropFrames$1(roundedFrameRate);
1117
+ var oneMinuteUndroppedFrames = 60 * roundedFrameRate;
1118
+ var oneMinuteDroppedFrames = 60 * roundedFrameRate - dropFrames;
1119
+ var tenMinuteFrames = 10 * (oneMinuteUndroppedFrames - dropFrames) + dropFrames;
1120
+ var tenMinuteChunks = Math.floor(frames / tenMinuteFrames);
1121
+ var minuteRemainder = Math.max(0, frames % tenMinuteFrames - oneMinuteUndroppedFrames);
1122
+ var oneMinuteChunks = Math.floor(minuteRemainder / oneMinuteDroppedFrames);
1123
+ var frameRemainder = minuteRemainder % oneMinuteDroppedFrames;
1124
+ var frameChunks = frameRemainder > 0 ? dropFrames : 0;
1125
+ return tenMinuteChunks * 9 * dropFrames + oneMinuteChunks * dropFrames + frameChunks;
1126
+ }
1127
+
1128
+ var isDropFrameTimeBase = function isDropFrameTimeBase(_ref) {
1129
+ var numerator = _ref.numerator,
1130
+ denominator = _ref.denominator;
1142
1131
  return numerator === 1001 && (denominator === 60000 || denominator === 30000);
1143
1132
  };
1144
1133
 
1145
1134
  var TimeCode = /*#__PURE__*/function () {
1146
1135
  function TimeCode() {
1147
- var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1148
- _ref4$samples = _ref4.samples,
1149
- samples = _ref4$samples === void 0 ? 0 : _ref4$samples,
1150
- timeBase = _ref4.timeBase;
1136
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1137
+ _ref2$samples = _ref2.samples,
1138
+ samples = _ref2$samples === void 0 ? 0 : _ref2$samples,
1139
+ timeBase = _ref2.timeBase;
1151
1140
 
1152
- var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1153
- dropFrame = _ref5.dropFrame,
1154
- _ref5$field = _ref5.field,
1155
- field = _ref5$field === void 0 ? 2 : _ref5$field;
1141
+ var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1142
+ dropFrame = _ref3.dropFrame,
1143
+ _ref3$field = _ref3.field,
1144
+ field = _ref3$field === void 0 ? 2 : _ref3$field;
1156
1145
 
1157
1146
  _classCallCheck__default["default"](this, TimeCode);
1158
1147
 
@@ -1260,7 +1249,7 @@ var TimeCode = /*#__PURE__*/function () {
1260
1249
  }, {
1261
1250
  key: "toTime",
1262
1251
  value: function toTime() {
1263
- var roundedFrameRate = getRoundedFrameRate(this.timeBase);
1252
+ var roundedFrameRate = getRoundedFrameRate$1(this.timeBase);
1264
1253
  var totalSamples = this.samples + (this.dropFrame ? countDroppedFrames(this.samples + 1, roundedFrameRate) : 0);
1265
1254
  var hours = Math.floor(totalSamples / (3600 * roundedFrameRate));
1266
1255
  var minutes = Math.floor(totalSamples / (60 * roundedFrameRate)) % 60;
@@ -1278,8 +1267,8 @@ var TimeCode = /*#__PURE__*/function () {
1278
1267
  }, {
1279
1268
  key: "toDuration",
1280
1269
  value: function toDuration() {
1281
- var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1282
- format = _ref6.format;
1270
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1271
+ format = _ref4.format;
1283
1272
 
1284
1273
  var _this$toTime = this.toTime(),
1285
1274
  hours = _this$toTime.hours,
@@ -1305,7 +1294,7 @@ var TimeCode = /*#__PURE__*/function () {
1305
1294
  }, {
1306
1295
  key: "toSmpte",
1307
1296
  value: function toSmpte() {
1308
- var _this2 = this;
1297
+ var _this = this;
1309
1298
 
1310
1299
  if (this.samples === -Infinity) return '00:00:00:00';
1311
1300
 
@@ -1323,7 +1312,7 @@ var TimeCode = /*#__PURE__*/function () {
1323
1312
  dropFrame = _thisSeparator$.dropFrame,
1324
1313
  field = _thisSeparator$.field;
1325
1314
 
1326
- return dropFrame === _this2.dropFrame && field === _this2.field;
1315
+ return dropFrame === _this.dropFrame && field === _this.field;
1327
1316
  }),
1328
1317
  _Object$entries$find2 = _slicedToArray__default["default"](_Object$entries$find, 1),
1329
1318
  _Object$entries$find3 = _Object$entries$find2[0],
@@ -1341,56 +1330,6 @@ var TimeCode = /*#__PURE__*/function () {
1341
1330
  return TimeCode;
1342
1331
  }();
1343
1332
 
1344
- var formatTimeBaseType = function formatTimeBaseType(timeBase) {
1345
- return new TimeBase(timeBase);
1346
- };
1347
-
1348
- var formatTimeBaseText = function formatTimeBaseText(timeBaseText) {
1349
- if (timeBaseText === undefined) {
1350
- return formatTimeBaseType();
1351
- }
1352
-
1353
- if (typeof timeBaseText === 'number') {
1354
- return formatTimeBaseType({
1355
- denominator: timeBaseText
1356
- });
1357
- }
1358
-
1359
- if (timeBaseText.includes(':')) {
1360
- var _timeBaseText$split = timeBaseText.split(':'),
1361
- _timeBaseText$split2 = _slicedToArray__default["default"](_timeBaseText$split, 2),
1362
- _denominator = _timeBaseText$split2[0],
1363
- numerator = _timeBaseText$split2[1];
1364
-
1365
- return formatTimeBaseType({
1366
- denominator: _denominator,
1367
- numerator: numerator
1368
- });
1369
- }
1370
-
1371
- if (Object.keys(CONSTANT_TIMEBASES).includes(timeBaseText)) {
1372
- return formatTimeBaseType(CONSTANT_TIMEBASES[timeBaseText]);
1373
- }
1374
-
1375
- var denominator = Number(timeBaseText);
1376
-
1377
- if (Number.isNaN(denominator)) {
1378
- throw new Error("timeBaseText must be a number or ".concat(Object.keys(CONSTANT_TIMEBASES).join(','), " - is ").concat(timeBaseText));
1379
- }
1380
-
1381
- return formatTimeBaseType({
1382
- denominator: denominator
1383
- });
1384
- };
1385
-
1386
- var formatTimeBase = function formatTimeBase(timeBase) {
1387
- if (_typeof__default["default"](timeBase) === 'object') {
1388
- return formatTimeBaseType(timeBase);
1389
- }
1390
-
1391
- return formatTimeBaseText(timeBase);
1392
- };
1393
-
1394
1333
  var formatTimeCodeType = function formatTimeCodeType(timeCode, options) {
1395
1334
  return new TimeCode(timeCode, options);
1396
1335
  };
@@ -1460,11 +1399,11 @@ var formatSeconds = function formatSeconds(seconds, timeBase, options) {
1460
1399
  throw new Error("seconds must be digits, is ".concat(seconds));
1461
1400
  }
1462
1401
 
1463
- var _ref7 = timeBase || {},
1464
- _ref7$denominator = _ref7.denominator,
1465
- denominator = _ref7$denominator === void 0 ? 1 : _ref7$denominator,
1466
- _ref7$numerator = _ref7.numerator,
1467
- numerator = _ref7$numerator === void 0 ? 1 : _ref7$numerator;
1402
+ var _ref = timeBase || {},
1403
+ _ref$denominator = _ref.denominator,
1404
+ denominator = _ref$denominator === void 0 ? 1 : _ref$denominator,
1405
+ _ref$numerator = _ref.numerator,
1406
+ numerator = _ref$numerator === void 0 ? 1 : _ref$numerator;
1468
1407
 
1469
1408
  var samples = seconds * (denominator / numerator);
1470
1409
  var timeCode = {
@@ -1479,13 +1418,13 @@ var formatSecondsPrecise = function formatSecondsPrecise(seconds, timeBase, opti
1479
1418
  throw new Error("seconds must be digits, is ".concat(seconds));
1480
1419
  }
1481
1420
 
1482
- var _ref8 = timeBase || {},
1483
- _ref8$numerator = _ref8.numerator,
1484
- numerator = _ref8$numerator === void 0 ? 1 : _ref8$numerator;
1421
+ var _ref = timeBase || {},
1422
+ _ref$numerator = _ref.numerator,
1423
+ numerator = _ref$numerator === void 0 ? 1 : _ref$numerator;
1485
1424
 
1486
- var _ref9 = timeBase || {},
1487
- _ref9$denominator = _ref9.denominator,
1488
- denominator = _ref9$denominator === void 0 ? 1 : _ref9$denominator;
1425
+ var _ref2 = timeBase || {},
1426
+ _ref2$denominator = _ref2.denominator,
1427
+ denominator = _ref2$denominator === void 0 ? 1 : _ref2$denominator;
1489
1428
 
1490
1429
  if (!Number.isInteger(seconds)) {
1491
1430
  var decimalPlaces = String(seconds).split('.')[1].length;
@@ -1503,17 +1442,87 @@ var formatSecondsPrecise = function formatSecondsPrecise(seconds, timeBase, opti
1503
1442
  return new TimeCode(timeCode, options);
1504
1443
  };
1505
1444
 
1445
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1446
+
1447
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1448
+
1449
+ var getDropFrames = function getDropFrames(roundedFrameRate) {
1450
+ return roundedFrameRate === 60 ? 4 : 2;
1451
+ };
1452
+
1453
+ var getRoundedFrameRate = function getRoundedFrameRate(timeBase) {
1454
+ return Math.round(timeBase.denominator / timeBase.numerator);
1455
+ };
1456
+
1457
+ var splitSmpte = function splitSmpte(smpteText) {
1458
+ var hasDropFrameSeparator = smpteText.match(/[^0-9:\-_]/);
1459
+ var hhmmssff;
1460
+ var frameOptions = {};
1461
+
1462
+ if (hasDropFrameSeparator) {
1463
+ var _hasDropFrameSeparato = _slicedToArray__default["default"](hasDropFrameSeparator, 1),
1464
+ frameSeparator = _hasDropFrameSeparato[0];
1465
+
1466
+ var _smpteText$split = smpteText.split(frameSeparator),
1467
+ _smpteText$split2 = _slicedToArray__default["default"](_smpteText$split, 2),
1468
+ hhmmss = _smpteText$split2[0],
1469
+ splitFrames = _smpteText$split2[1];
1470
+
1471
+ hhmmssff = [].concat(_toConsumableArray__default["default"](hhmmss.split(':')), [splitFrames]);
1472
+ frameOptions = FRAME_SEPARATORS[frameSeparator] || {};
1473
+ } else {
1474
+ hhmmssff = smpteText.split(':');
1475
+ }
1476
+
1477
+ hhmmssff = hhmmssff.map(Number);
1478
+
1479
+ if (hhmmssff.length > 4 || hhmmssff.some(function (n) {
1480
+ return Number.isNaN(n);
1481
+ })) {
1482
+ throw new Error('Invalid SMPTE timecode');
1483
+ }
1484
+
1485
+ return [hhmmssff, frameOptions];
1486
+ };
1487
+
1488
+ var countSamples = function countSamples(hh, mm, ss, ff, _ref) {
1489
+ var dropFrame = _ref.dropFrame,
1490
+ roundedFrameRate = _ref.roundedFrameRate;
1491
+
1492
+ if (!dropFrame) {
1493
+ return hh * 3600 * roundedFrameRate + mm * 60 * roundedFrameRate + ss * roundedFrameRate + ff;
1494
+ }
1495
+
1496
+ if (![30, 60].includes(roundedFrameRate)) {
1497
+ throw new Error('Cannot use dropframe with non NTSC timebase');
1498
+ }
1499
+
1500
+ var dropFrames = getDropFrames(roundedFrameRate);
1501
+ var shouldDropMinute = mm % 10 !== 0;
1502
+ var shouldDropSecond = shouldDropMinute && ss === 0;
1503
+ var hourFrames = hh * (3600 * roundedFrameRate - 54 * dropFrames);
1504
+ var minuteFrames = mm * 60 * roundedFrameRate - (mm - Math.ceil(mm / 10)) * dropFrames;
1505
+ var secondFrames = ss * roundedFrameRate - (shouldDropMinute && ss > 1 ? dropFrames : 0);
1506
+
1507
+ if (shouldDropSecond && ff < dropFrames) {
1508
+ throw new Error('Invalid ff');
1509
+ }
1510
+
1511
+ var frameFrames = shouldDropSecond ? ff - dropFrames : ff;
1512
+ return hourFrames + minuteFrames + secondFrames + frameFrames;
1513
+ };
1514
+
1506
1515
  var formatSmpte = function formatSmpte(smpteText, timeBaseText) {
1507
1516
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1508
1517
 
1509
1518
  if (smpteText === undefined) {
1510
1519
  var _timeBase = formatTimeBase(timeBaseText);
1511
1520
 
1512
- var _timeCode6 = {
1521
+ var _timeCode = {
1513
1522
  samples: 0,
1514
1523
  timeBase: _timeBase
1515
1524
  };
1516
- return formatTimeCodeType(_timeCode6);
1525
+ return formatTimeCodeType(_timeCode);
1517
1526
  }
1518
1527
 
1519
1528
  if (typeof smpteText !== 'string') {
@@ -1575,7 +1584,7 @@ function timeToCueTime(_ref) {
1575
1584
  */
1576
1585
 
1577
1586
 
1578
- function metadataTypeToWebVtt(_ref2) {
1587
+ var metadataTypeToWebVtt = function metadataTypeToWebVtt(_ref2) {
1579
1588
  var metadataType = _ref2.metadataType,
1580
1589
  _ref2$subtitleGroup = _ref2.subtitleGroup,
1581
1590
  subtitleGroup = _ref2$subtitleGroup === void 0 ? 'stl_subtitle' : _ref2$subtitleGroup,
@@ -1611,7 +1620,7 @@ function metadataTypeToWebVtt(_ref2) {
1611
1620
  return "".concat(start, " --> ").concat(end, " line:0%\r").concat(text, "\r");
1612
1621
  });
1613
1622
  return "WEBVTT\n\n\n".concat(vttCues.join('\n'));
1614
- }
1623
+ };
1615
1624
 
1616
1625
  var createFacetType = function createFacetType() {
1617
1626
  var fieldList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];