Open ghost opened 10 years ago
There are two similar demos:
In simple words, each RTCMultiConnection object MUST have unique channel-id:
<script src="//www.rtcmulticonnection.org/latest.js"></script>
<button id="openNewSessionButton">Open New Room</button>
<script>
var firstConnection = new RTCMultiConnection('first-channel');
// easiest way to customize what you need!
firstConnection.session = {
audio: true,
video: true
};
// on getting local or remote media stream
firstConnection.onstream = function (e) {
document.body.appendChild(e.mediaElement);
};
// setup signaling channel
firstConnection.connect();
// open new session
document.querySelector('#openNewSessionButton').onclick = function () {
firstConnection.open();
secondConnection.open();
};
// ----------------------------------------------
var secondConnection = new RTCMultiConnection('second-channel');
// easiest way to customize what you need!
secondConnection.session = {
screen: true,
oneway: true
};
// on getting local or remote media stream
secondConnection.onstream = function (e) {
document.body.appendChild(e.mediaElement);
};
// setup signaling channel
secondConnection.connect();
</script>
Instead of passing over constructor, channel-id can be set like this:
firstConnection.channel = 'first-channel';
secondConnection.channel = 'second-channel';
Hi!!! I'm using 2 connections in same page, its possible ? 1 connection is oneway another is many-to-many!
I'm using this code:
where this error ?