getMediaTrack function

MediaStreamTrack getMediaTrack({
  1. required MediaStream stream,
  2. required String kind,
})

Implementation

MediaStreamTrack getMediaTrack({
  required MediaStream stream,
  required String kind,
}) {
  final tracks = stream.getTracks();
  for (final track in tracks) {
    if (track.kind == kind) {
      return track;
    }
  }
  throw StateError('Track Not Found');
}