webRTC Video Calling in web

421 Views Asked by At

I am currently working on video calling app using webRTC. I have implemented it using

  1. peer-to-peer
  2. openTok
  3. simplewebrtc

Componets that I was able to implement was:

  1. creating room

  2. two or more users can join this room

  3. real time chat can be done

  4. video can be disabled

  5. video recording

    calling is done :

  6. call initiator is creating a room

  7. participants are joining the room using room name

but I want a mechanism that initiator dial a call to participant.And participant should pick or reject a call.. How it can be done using simplewebRTC or openTok ? Or which other libraries supports the above feature.. Please help..

<script src="scripts/simplewebrtc/out/simplewebrtc-with-adapter.bundle.js"></script>

// We got access to local camera
webrtc.on('localStream', () => {
    console.log("hello");
    localVideo.show();
});
function action(data) {
    username = $('#username').val();
    const roomName = $('#roomName').val().toLowerCase();
    reject.hide();
    if (data === 'create-btn') {
        createRoom(roomName);
    }else if(data === 'reject'){
        console.log("reject");
    }
    else {
        joinRoom(roomName);
    }
    return false;
};

// Join existing Chat Room
const joinRoom = (roomName) => {
    console.log(`Joining Room: ${roomName}`);
    webrtc.joinRoom(roomName);
    showChatRoom(roomName);
    postMessage(`${username} joined chatroom`);
};

// Remote video was added
webrtc.on('videoAdded', function (video, peer) {
    console.log('video added', peer);
    let remotes = document.getElementById('remote-videos');
    if (remotes) {
        let d = document.createElement('div');
        d.className = 'videoContainer';
        d.id = 'container_' + webrtc.getDomId(peer);
        d.appendChild(video);
     
        remotes.appendChild(d);
    }
    
//VIDEO REMOVED
webrtc.on('videoRemoved', function (video, peer) {
        console.log('video removed ', peer);
        let remotes = document.getElementById('remote-videos');
        let el = document.getElementById('container_' + webrtc.getDomId(peer));
        if (remotes && el) {
            remotes.removeChild(el);
        }
    });
});

0

There are 0 best solutions below