Build a screen share application like zoom and google meet

Search for a command to run...

No comments yet. Be the first to comment.
With WebRTC, you can add real-time communication capabilities to your application that works on top of an open standard.
Hello there, In this article, we would be building a file transfer application using webRTC and node.js. This app would let users transfer heavy files to each other without the need for a server. Note, in order to proceed with the tutorial, I would ...
Twitter is one of the most popular social media platforms in the world, with over 330 million active users as of 2021. If you are interested in building a Twitter-like application, this tutorial will guide you through the process of building a FullSt...

Hey everyone, In this article, we will build our own Tic Tac Toe game using pure Javascript. https://youtu.be/lKe57l8sttw Code <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE...

Hi everyone, In this blog, we will learn how we can create node.js functions locally and deploy them to AWS Lambda using serverless. So, let's get started. Step 1. Create an AWS Account ☁️ In order to deploy functions to AWS Lambda, you should have a...

Hey there, In this article, we are going to learn how you can upload any file to firebase storage. Uploading files to firebase storage is really easy. I would I recommend you to code along with me for better understanding. So, let's get started. Step...

Hey there, Welcome back. In this article, I would be showing you how I made a collaborative IDE with a video call. The main application of this application is that you can create a room and people can join the room. You have the ability to write mark...

Hello there, In this article, I would be showing you how you can make a web application that allows you to share your screen with other people.
Now, very important note, in order to create this application you need to understand WebRTC and this tutorial is an extended to my previous article in which I had thought about how to build a video call application using webRTC. If you have already read that article you are ready to go. If not, please go and read that first.
Link: Build video call application with webRTC
Let's begin
Okay, trust me, this is going to be a very short and easy tutorial. You need to add few lines to our video call application that we build here-> Build video call application with webRTC
Just add the following code and boom! now you are able to share your screen as well, along with video.
const getUserMedia = async () => {
const userMedia = await navigator.mediaDevices.getUserMedia({
video: true
});
// Capture the screen stream
const screenSteam = await navigator.mediaDevices.getDisplayMedia();
const videoEle = document.getElementById('local-video');
videoEle.srcObject = userMedia;
videoEle.play()
// This is our webcam stream
for (let track of userMedia.getTracks()) {
peer.addTrack(track, userMedia)
}
// Finally add the screen stream to peer
for (let track of screenSteam.getTracks()){
peer.addTrack(track, userMedia)
}
}
Okay, there is a task for you, we made a `peer.ontrack event listener which receives an array of streams. You have to loop over these streams and render multiple video tags dynamically and add the stream to the video's srcObject. Good luck 🙂
Hint
In peer.ontrack method, we can get video and audio tracks:
peer.ontrack = async(ev) => {
ev.streams[0].getAudioTracks(); // Returns all the audio tracks
ev.streams[0].getVideoTracks(); // Returns all the audio tracks
}
Just in case, you want me to make a full tutorial on this, do leave a comment.
Happy learning