Blame view

node_modules/videojs-contrib-media-sources/src/remove-cues-from-track.js 688 Bytes
2a09d1a4   liuqimichale   添加宜春 天水 宣化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  /**
   * @file remove-cues-from-track.js
   */
  
  /**
   * Remove cues from a track on video.js.
   *
   * @param {Double} start start of where we should remove the cue
   * @param {Double} end end of where the we should remove the cue
   * @param {Object} track the text track to remove the cues from
   * @private
   */
  const removeCuesFromTrack = function(start, end, track) {
    let i;
    let cue;
  
    if (!track) {
      return;
    }
  
    if (!track.cues) {
      return;
    }
  
    i = track.cues.length;
  
    while (i--) {
      cue = track.cues[i];
  
      // Remove any overlapping cue
      if (cue.startTime <= end && cue.endTime >= start) {
        track.removeCue(cue);
      }
    }
  };
  
  export default removeCuesFromTrack;