Flutter webrtc screen sharing
1,027
You can use the flutter_webrtc plugin and do like this method ( use getDisplayMedia method in webRTC to get display ) :
class ScreenSharing {
MediaStream? _localStream;
final RTCVideoRenderer _localRenderer = RTCVideoRenderer();
Future<void> _makeScreenSharing() async {
final mediaConstraints = <String, dynamic>{'audio': true, 'video': true};
try {
var stream = await navigator.mediaDevices.getDisplayMedia(mediaConstraints);
_localStream = stream;
_localRenderer.srcObject = _localStream;
} catch (e) {
print(e.toString());
}
}
}
Author by
Dima Nizanov
Updated on January 01, 2023Comments
-
Dima Nizanov over 1 year
I have a flutter project (iOS, Android) that uses WebRTC. I need to send video from camera (working correctly) and screen capture by WebRTC. How to share the screen on WebRTC with the flutter_webrtc package?
-
Admin over 2 yearsPlease edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
-
Hardik1344 about 2 years@YeasinSheikh can you please share the demo url for screen share?
-
Yeasin Sheikh about 2 yearsWebRTC repo and callPage @Hardik1344
-
Hardik1344 about 2 yearsthank you sir, I want to add screen share functionality. is it available in your repo sir?
-
-
Hardik1344 about 2 yearscan you please share full demo example if you have?
-
Dyadee about 2 years@Mojtaba Ghiasi were you able to run this on iOS and Android? For me it only functions well for desktop browsers.