clipIndexAt method
Index of the clip playing at project time time, or -1 when empty.
Implementation
int clipIndexAt(Duration time) {
if (clips.isEmpty) return -1;
var offset = Duration.zero;
for (var i = 0; i < clips.length; i++) {
final end = offset + clips[i].effectiveDuration;
if (time < end) return i;
offset = end;
}
return clips.length - 1;
}