MenuMenu

RTCMultiConnection.sdpConstraints

You can force constraints that should be used each time when createOffer/createAnswer API are invoked

Usage

connection.sdpConstraints = {
    mandatory: {
        OfferToReceiveAudio: true,
        OfferToReceiveVideo: true,
        VoiceActivityDetection: false,
        IceRestart: false
    },
    optional: []
};

Description

parameterdescription
mandatory ask browser to apply these conditions; otherwise fail
"OfferToReceiveAudio" ask browser to receive audio from remote peers
"OfferToReceiveVideo" ask browser to receive video from remote peers
optional optional conditions; ask browser to choose this option if available, otherwise fallback
browser will not fail if condition doesn't applies

Demo

<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script>
<script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script>

<script>
var connection = new RTCMultiConnection();

// this line is VERY_important
connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/';

// if you want audio+video conferencing
connection.session = {
    audio: true,
    video: true
};

connection.sdpConstraints = {
    mandatory: {
        OfferToReceiveAudio: true,
        OfferToReceiveVideo: true
    },
    optional: []
};

connection.openOrJoin('your-room-id');
</script>