findLyricIndexByDuration method

int findLyricIndexByDuration (
  1. double curDuration,
  2. List<Lyric> lyrics
)

Implementation

int findLyricIndexByDuration(double curDuration, List<Lyric> lyrics) {
  for (int i = 0; i < lyrics.length; i++) {
    if (curDuration >= lyrics[i].startTime.inMilliseconds &&
        curDuration <= lyrics[i].endTime.inMilliseconds) {
      return i;
    }
  }
  return 0;
}