hasVideoToSend method
returns whether a 1:1 call sender has video tracks
Implementation
Future<bool> hasVideoToSend() async {
final transceivers = await pc!.getTransceivers();
final localUserMediaVideoTrack = localUserMediaStream?.stream
?.getTracks()
.singleWhereOrNull((track) => track.kind == 'video');
// check if we have a video track locally and have transceivers setup correctly.
return localUserMediaVideoTrack != null &&
transceivers.singleWhereOrNull((transceiver) =>
transceiver.sender.track?.id == localUserMediaVideoTrack.id) !=
null;
}