Build live video calling app in Java Script
It just takes just 10 minutes to embed a scalable and engaging video calling application
Add video call using javascript and chat feature can be easily integrated into JavaScript in just 5 steps and just 5 minutes. enabling 5000 users to video chat in a web and app.
We will also implement a demo and use Video SDK to make a video call using rtc-js-prebuilt
Introduction
Video calling is becoming norm for everyone. According to Cisco, 87% of the workforce says they feel more connected to each other when using video.
Video Calling in Javascript Prebuilt SDK provides best video chat experience with just 10 lines of code. It provides inbuilt support for
- 10,000 minutes free each month
- Completely Low code and serverless.
- Video API with real-time audio, video and data streams
- 5,000+ participants support
- Chat support with rich media.
- Screen sharing with HD and Full HD.
- Play realtime video in meeting
- Connect it with social media such as Facebook, Youtube etc (RTMP out support).
- Intelligent speaker switch
- Record your meetings on cloud
- Inbuilt support of whiteboard, poll and Q & A.
- Customize UI as per your needs.
Let's begin with the prebuilt sdk setup. Read all the steps carefully before installing one in your application.
It supports all the modern frameworks such as plain JavaScript, React JS, Vue JS and Angular JS.
#Step 5: Video Calling in Javascript
##1: First of all, Register yourself to app.videosdk.live
##2: Generate an API key and Secret
Implementation
##3: Import the script in your html page
<script src="https://sdk.videosdk.live/rtc-js-prebuilt/0.1.4/rtc-js-prebuilt.js"></script>
Note: You can also use official Npm package: rtc-js-prebuilt
##4: Add Video Calling javascript prebuilt code to your HTML page
<script>
var script = document.createElement("script");
script.type = "text/javascript";
script.addEventListener("load", function (event) {
const meeting = new VideoSDKMeeting();
const config = {
name: "John Doe",
apiKey: "<API KEY>", // generated in Setup
meetingId: "milkyway", // enter your meeting id
containerId: null,
redirectOnLeave: "https://www.videosdk.live/",
micEnabled: true,
webcamEnabled: true,
participantCanToggleSelfWebcam: true,
participantCanToggleSelfMic: true,
chatEnabled: true,
screenShareEnabled: true,
pollEnabled: true,
whiteBoardEnabled: true,
raiseHandEnabled: true,
recordingEnabled: true,
recordingWebhookUrl: "https://www.videosdk.live/callback",
participantCanToggleRecording: true,
brandingEnabled: true,
brandLogoURL: "https://picsum.photos/200",
brandName: "Awesome startup",
poweredBy: true,
participantCanLeave: true, // if false, leave button won't be visible
// Live stream meeting to youtube
livestream: {
autoStart: true,
outputs: [
// {
// url: "rtmp://x.rtmp.youtube.com/live2",
// streamKey: "<STREAM KEY FROM YOUTUBE>",
// },
],
},
permissions: {
askToJoin: false, // Ask joined participants for entry in meeting
toggleParticipantMic: true, // Can toggle other participant's mic
toggleParticipantWebcam: true, // Can toggle other participant's webcam
},
joinScreen: {
visible: true, // Show the join screen ?
title: "Daily scrum", // Meeting title
meetingUrl: window.location.href, // Meeting joining url
},
};
meeting.init(config);
});
script.src =
"https://sdk.videosdk.live/rtc-js-prebuilt/0.1.5/rtc-js-prebuilt.js";
document.getElementsByTagName("head")[0].appendChild(script);
</script>
##5: Insert API key in your code to run it
apiKey: "<API-KEY>"
Note: To restrict use of your API key on other domains, you can add domain URL which will block use of your API key in other domains.
Run the demo
To run the demo, you have to use any local server. Best could be Xampp or IIS as per your environment. We are going to use live-server package to run simple http server.
$ npm install -g live-server
$ live-server --port=8000
and open http://localhost:8000 in your web browser.
Record the meeting
To record the meeting, You have to first enable recording flag in the configuration.
- recordingEnabled: set
true
orfalse
to enable and disable online recordings - recordingWebhookUrl: Callback url, generally helps to store recording details on your database.
recordingEnabled: true,
recordingWebhookUrl: "https://www.videosdk.live/callback",
After enabling recording option, you'll be able to see recording button on the screen. Click on it to start and stop recording
Go live on social media
To enable live streaming, you have to configure list of stream key and URL. We only support RTMP protocol enabled broadcasting.
- autoStart: If
true
, it will trigger re-streaming automatically when meeting will start.
livestream: {
autoStart: true,
outputs: [
// {
// url: "rtmp://x.rtmp.youtube.com/live2",
// streamKey: "<STREAM KEY FROM YOUTUBE>",
// },
],
}
Conclusion
In this article, I have explained Video Chat in JavaScript. You can modify couple of parameters in code according to your need. This was the small introduction to Video SDK Prebuilt SDK.
Here is video version of the same.
I hope this blog helped you understand Video Calling of Video SDK. For more information visit official documentation of Video SDK.
P.S. Find official example of Video SDK No Code Prebuilt App