remove-cues-from-track.js 852 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @file remove-cues-from-track.js
  3. */
  4. /**
  5. * Remove cues from a track on video.js.
  6. *
  7. * @param {Double} start start of where we should remove the cue
  8. * @param {Double} end end of where the we should remove the cue
  9. * @param {Object} track the text track to remove the cues from
  10. * @private
  11. */
  12. "use strict";
  13. Object.defineProperty(exports, "__esModule", {
  14. value: true
  15. });
  16. var removeCuesFromTrack = function removeCuesFromTrack(start, end, track) {
  17. var i = undefined;
  18. var cue = undefined;
  19. if (!track) {
  20. return;
  21. }
  22. if (!track.cues) {
  23. return;
  24. }
  25. i = track.cues.length;
  26. while (i--) {
  27. cue = track.cues[i];
  28. // Remove any overlapping cue
  29. if (cue.startTime <= end && cue.endTime >= start) {
  30. track.removeCue(cue);
  31. }
  32. }
  33. };
  34. exports["default"] = removeCuesFromTrack;
  35. module.exports = exports["default"];