/// <summary> /// Callback invoked when a transceiver is added to the peer connection, either from /// applying a remote offer/answer, or from manually adding it. In the latter case, the /// transceiver has already a view model in the pending collection. In the former case, /// create a view model for it and add it to the negotiated collection. /// </summary> /// <param name="transceiver">The newly added transceiver.</param> private void OnTransceiverAdded(Transceiver transceiver) { Logger.Log($"Added transceiver '{transceiver.Name}' (mid=#{transceiver.MlineIndex})."); ThreadHelper.RunOnMainThread(() => { var trvm = new TransceiverViewModel(transceiver); Transceivers.Add(trvm); }); }
/// <summary> /// Callback on remote videa track added. /// /// For simplicity this grabs the first remote video track found and uses it to render its /// content on the right pane of the Tracks window. /// </summary> /// <param name="track">The video track added.</param> /// <seealso cref="RemoteVideoTrack_I420AFrameReady"/> private void OnRemoteVideoTrackAdded(RemoteVideoTrack track) { Logger.Log($"Added remote video track {track.Name} of transceiver {track.Transceiver.Name}."); ThreadHelper.RunOnMainThread(() => { var trvm = Transceivers.SingleOrDefault(tr => tr.Transceiver == track.Transceiver); Debug.Assert(trvm.Transceiver.RemoteVideoTrack == track); trvm.NotifyReceiverChanged(); // this is thread-aware // This raises property changed events in current thread, needs to be main one VideoTracks.Add(new VideoTrackViewModel(track)); }); }
private void LocalVideoTrackCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { Transceivers.RefreshSenderList(MediaKind.Video, force: true); }