Open altanai opened 10 years ago
<h1>RTCMultiConnection & Password Protected Conferencing</h1>
<button id="setup">Setup RTC-Multi-Connection</button><hr />
<script src="https://www.webrtc-experiment.com/RTCMultiConnection-v1.4.js"></script>
<script src="https://www.webrtc-experiment.com/firebase.js"></script>
<script>
document.querySelector('#setup').onclick = function () {
// room password has been set before calling "open" method
connection.extra.password = 'valid-password';
connection.open();
this.disabled = true;
};
var connection = new RTCMultiConnection();
connection.onNewSession = function (session) {
// set password for person who is trying to join the room
connection.extra.password = 'wrong-password';
connection.join(session);
};
connection.onRequest = function (userid, extra) {
// validating password in "onRequest"
if (extra.password != connection.extra.password)
throw 'password: ' + extra.password + ' !== ' + connection.extra.password;
connection.accept(userid, extra);
};
connection.onstream = function (e) {
document.body.appendChild(e.mediaElement);
};
connection.connect();
window.skipRTCMultiConnectionLogs = true;
</script>
<style>html {background: rgb(255, 252, 239);}audio,video {width:40%;vertical-align:top;}</style>
onRequest
allows you verify incoming participation requests.onNewSession
allows you set password for users who are trying to join conferencing room.For initiator, you can set extra
object before calling open
method:
connection.extra.password = 'room-password';
connection.open();
HI , Ca I use this code for RTCMulticonnection v3?
I am trying to password protect the multi party conference room joining , however session ceases to exist if url is redirected or any additional parameters such as memeber name or meeting id is added to the existsing url of created conference .