setClip method

Future<Duration?> setClip({
  1. Duration? start,
  2. Duration? end,
})

Clips the current AudioSource to the given start and end timestamps. If start is null, it will be reset to the start of the original AudioSource. If end is null, it will be reset to the end of the original AudioSource. This method cannot be called from the ProcessingState.idle state.

Implementation

Future<Duration?> setClip({Duration? start, Duration? end}) async {
  if (_disposed) return null;
  _setPlatformActive(true)?.catchError((dynamic e) async => null);
  final duration = await _load(
      await _platform,
      start == null && end == null
          ? _audioSource!
          : ClippingAudioSource(
              child: _audioSource as UriAudioSource,
              start: start,
              end: end,
            ));
  return duration;
}