getMediaStreamKind function

dynamic getMediaStreamKind(
  1. MediaStream stream
)

Implementation

getMediaStreamKind(MediaStream stream) {
  String? kind;

  final tracks = stream.getTracks();

  for (final track in tracks) {
    if (track.kind == 'audio') {
      kind = 'audio';
      break;
    } else if (track.kind == 'video') {
      kind = 'video';
      break;
    }
  }
  if (kind == null) {
    throw Exception('Stream Kind Not Found');
  }
  return kind;
}