ios – Broadcast upload extension flutter webrtc


I am trying to add screen sharing for iOS in my flutter app using flutter-webrtc.
Following the steps explained in this document, I have managed to start the broadcast extension using this

MediaStream mediaStream =
        await navigator.mediaDevices.getDisplayMedia(<String, dynamic>{
      'audio': false,
      'video': Platform.isIOS ? {'deviceId': 'broadcast'} : true
        voiceonly: false, mediaStream: mediaStream, headers: customHeaders);

but there are two things I need help with. Will be highly appreciated.

  1. How to observe the broadcastStarted, broadcastFinished on my callscreen.dart so that I can handle/update the current call state? For example, I need to make the call when the broadcast starts and end the call when the broadcast finishes.
  2. Why is the media stream not getting published even after the screen broadcast is started?

Let me know if anyone can point me in the right direction. Thanks