RTCMultiConnection Docs

RTCMultiConnection API Reference / "DetectRTC" object

"DetectRTC" object can be used to detect WebRTC features support, as well as chrome screen capturing extension availability and many other useful features.
if(connection.DetectRTC.hasMicrophone) {
    // seems current system has at least one audio input device
}

if(connection.DetectRTC.hasSpeakers) {
    // seems current system has at least one audio output device
}

if(connection.DetectRTC.hasWebcam) {
    // seems current system has at least one video input device
}

// it is recommended to checked above three features inside "DetectRTC.load" method
connection.DetectRTC.load(function() {
    if(connection.DetectRTC.hasMicrophone) {
        // seems current system has at least one audio input device
    }

    if(connection.DetectRTC.hasSpeakers) {
        // seems current system has at least one audio output device
    }

    if(connection.DetectRTC.hasWebcam) {
        // seems current system has at least one video input device
    }
});

DetectRTC.MediaDevices

// to iterate over all available media devices
connection.getDevices(function() {
    connection.DetectRTC.MediaDevices.forEach(function(device) {
        // device.deviceId
        // device.kind == 'audioinput' || 'audiooutput' || 'audio'
        
        connection.selectDevices(device.deviceId);
    });
});

DetectRTC.screen

// want to use custom screen capturing extension?
// by default, RTCMultiConnection uses this extension
connection.DetectRTC.screen.extensionid = 'your-app-store-extensionid';

// set type of capturing API
connection.DetectRTC.screen.chromeMediaSource = 'desktop'; // screen || desktop

connection.DetectRTC.screen.isChromeExtensionAvailable(function(available){
    // available == true or false
});

connection.DetectRTC.screen.getSourceId(function(sourceId){
    // sourceId === 'string'
    
    if(sourceId == 'PermissionDeniedError') {
        // permission denied
    }
});

var extensionid = 'ajhifddimkapgcifgcodmmfdlknahffk';
connection.DetectRTC.screen.getChromeExtensionStatus(extensionid, function(status) {
    if(status == 'installed-enabled') {
        // chrome extension is installed & enabled.
    }
    
    if(status == 'installed-disabled') {
        // chrome extension is installed but disabled.
    }
    
    if(status == 'not-installed') {
        // chrome extension is not installed
    }
    
    if(status == 'not-chrome') {
        // using non-chrome browser
    }
});

// if following function is defined, it will be called if screen capturing extension seems available
connection.DetectRTC.screen.onScreenCapturingExtensionAvailable = function() {
    // hide inline-install button
};

Usual features

if(connection.DetectRTC.isWebRTCSupported) {
    // seems WebRTC compatible client
}

if(connection.DetectRTC.isAudioContextSupported) {
    // seems Web-Audio compatible client
}

if(connection.DetectRTC.isScreenCapturingSupported) {
    // seems WebRTC screen capturing feature is supported on this client
}

if(connection.DetectRTC.isSctpDataChannelsSupported) {
    // seems WebRTC SCTP data channels feature are supported on this client
}

if(connection.DetectRTC.isRtpDataChannelsSupported) {
    // seems WebRTC (old-fashioned) RTP data channels feature are supported on this client
}

Want to ask a Question?

You can include your email for private conversation!

Latest Updates