initRenderer method

Future<void> initRenderer(
  1. MediaDisplayDetails display
)

Initializes a RtcVideoRenderer for the provided display.

Implementation

Future<void> initRenderer(MediaDisplayDetails display) async {
  final List<LocalMediaTrack> tracks = await MediaUtils.getTracks(
    screen: ScreenPreferences(device: display.deviceId(), framerate: 5),
  );

  _localTracks.addAll(tracks);

  final RtcVideoRenderer renderer = RtcVideoRenderer(tracks.first);
  await renderer.initialize();
  renderer.srcObject = tracks.first.getTrack();

  renderers[display] = renderer;
}