tracksWithTypes property

List<TrackWithType> get tracksWithTypes

Get tracks with their types for producing

Includes the source stream reference for proper camera release on macOS.

Implementation

List<TrackWithType> get tracksWithTypes {
  final result = <TrackWithType>[];
  if (audioTrack != null) {
    result.add(TrackWithType(
      track: audioTrack!,
      type: StreamType.audio,
      sourceStream: stream, // Pass the original stream from getUserMedia
    ),);
  }
  if (videoTrack != null) {
    result.add(TrackWithType(
      track: videoTrack!,
      type: StreamType.video,
      sourceStream: stream, // Pass the original stream from getUserMedia
    ),);
  }
  if (screenshareTrack != null) {
    result.add(TrackWithType(
      track: screenshareTrack!,
      type: StreamType.screenshare,
      sourceStream: screenshareStream, // Pass the screen share stream
    ),);
  }
  // Note: screenshareAudioTrack is typically mixed with the screenshare
  return result;
}