我目前正在使用webRTC开发视频通话应用。 我已经使用
实现了它我能够实现的组件是:
录像
通话完成:
呼叫发起人正在创建会议室
但是我想要一个发起者拨打参与者电话的机制。参与者应该选择或拒绝呼叫。如何使用simplewebRTC或openTok完成它?或哪些其他库支持上述功能。 请帮忙。
<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);
}
});
});