Skip to content

DetectRTC is a tiny JavaScript library that can be used to detect WebRTC features e.g. system having speakers, microphone or webcam, screen capturing is supported, number of audio/video devices etc. https://www.webrtc-experiment.com/DetectRTC/

License

Notifications You must be signed in to change notification settings

brianetaveras/DetectRTC

Repository files navigation

A tiny JavaScript library that can be used to detect WebRTC features e.g. system having speakers, microphone or webcam, screen capturing is supported, number of audio/video devices etc.

It is MIT Licenced, which means that you can use it in any commercial/non-commercial product, free of cost.

npm install detectrtc

# or
bower install detectrtc

# you can test in localhost as well
node server   # http://127.0.0.1:9001 or http://localhost:9001

To use it:

<script src="./node_modules/detectrtc/DetectRTC.js"></script>

<!-- or CDN link -->
<script src="//cdn.webrtc-experiment.com/DetectRTC.js"></script>

Check all releases:

How to use it?

DetectRTC.load(function() {
    // DetectRTC.hasWebcam (has webcam device!)
    // DetectRTC.hasMicrophone (has microphone device!)
    // DetectRTC.hasSpeakers (has speakers!)
    // DetectRTC.isScreenCapturingSupported
    // DetectRTC.isSctpDataChannelsSupported
    // DetectRTC.isRtpDataChannelsSupported
    // DetectRTC.isAudioContextSupported
    // DetectRTC.isWebRTCSupported
    // DetectRTC.isDesktopCapturingSupported
    // DetectRTC.isMobileDevice
    // DetectRTC.isWebSocketsSupported
    
    // DetectRTC.osName
    
    // DetectRTC.browser.name === 'Edge' || 'Chrome' || 'Firefox'
    // DetectRTC.browser.version
    // DetectRTC.browser.isChrome
    // DetectRTC.browser.isFirefox
    // DetectRTC.browser.isOpera
    // DetectRTC.browser.isIE
    // DetectRTC.browser.isSafari
    // DetectRTC.browser.isEdge

    // DetectRTC.isCanvasSupportsStreamCapturing
    // DetectRTC.isVideoSupportsStreamCapturing

    // DetectRTC.DetectLocalIPAddress(callback)
});

Why load method?

If you're not detecting audio/video input/outupt devices then you can skip this method.

DetectRTC.load simply makes sure that all devices are captured and valid result is set for relevant properties.

Demo

License

DetectRTC.js is released under MIT licence . Copyright (c) Muaz Khan.

About

DetectRTC is a tiny JavaScript library that can be used to detect WebRTC features e.g. system having speakers, microphone or webcam, screen capturing is supported, number of audio/video devices etc. https://www.webrtc-experiment.com/DetectRTC/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 74.5%
  • HTML 25.5%