getTrackById method

MediaStreamTrack? getTrackById(
  1. String trackId
)

Returns either a MediaStreamTrack object from this stream's track set whose id is equal to trackId, or StateError, if no such track exists.

Implementation

MediaStreamTrack? getTrackById(String trackId) {
  for (var item in getTracks()) {
    if (item.id == trackId) {
      return item;
    }
  }
  return null;
}