code: function getStartEnd(item, media) {
    let { start, end } = item;
    if (!start || start < 0) {
      start = 0;
    } else if (start > media.duration) {
      start = media.duration;
    }
    if (!end || end > media.duration) {
      end = media.duration;
    } else if (end < start) {
      end = start;
    }
    return { start, end };
  }
docs: Calculate valid start/end times for a playlist item.