releaseResources method

void releaseResources()

Release resources to avoid leaks

Implementation

void releaseResources() {
  _timer.cancel();
  _webcamVideoElement.pause();
  _webcamVideoElement.srcObject?.getTracks().forEach((track) {
    track.stop();
    track.enabled = false;
  });
  _webcamVideoElement.srcObject = null;
  _canvasElement.remove();
  _webcamVideoElement.remove();
  imageElement.remove();
}