pauseCopy method

Producer pauseCopy()

Pauses sending media and return new Instance of same Producer.

Implementation

Producer pauseCopy() {
  _logger.debug('pauseCopy()');

  if (closed) {
    _logger.error('pauseCopy() | Producer closed');

    return this;
  }

  // paused = true;

  if (disableTrackOnPause) {
    track.enabled = false;
  }

  if (zeroRtpOnPause) {
    safeEmitAsFuture('@replacetrack').catchError((error, stackTrace) {});
  }

  // Emit observer event.
  observer.safeEmit('pause');

  return copyWith(paused: true);
}