applyConstraints | RTCMultiConnection

Firefox browser allows you modify your camera resolutions in a LIVE session.

Change camera resolutions

var width = 1280;
var height = 720;

var supports = navigator.mediaDevices.getSupportedConstraints();

var constraints = {};
if (supports.width && supports.height) {
    constraints = {
        width: width,
        height: height
    };
}

connection.applyConstraints({
    video: constraints
});

Description

parameterdescription
audio {deviceId: ''}
video {width:'', height: '', frameRate: '', etc: ''}

Demo

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

<hr><button id="apply-constraints">Apply Constraints</button><hr>

<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.openOrJoin('your-room-id');

document.getElementById('apply-constraints').onclick = function() {
    this.disabled = true;

    var width = 1280;
    var height = 720;

    var supports = navigator.mediaDevices.getSupportedConstraints();

    var constraints = {};
    if (supports.width && supports.height) {
        constraints = {
            width: width,
            height: height
        };
    }

    connection.applyConstraints({
        video: constraints
    });
};
</script>