npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

realtimecat-rtc-detect

v0.1.1

Published

detect browsers' info and webrtc compatibility

Downloads

4

Readme

实时猫浏览器检测工具 | RTC Detect

关于

实时猫采用了一系列的先进技术, 使用户打开浏览器即拥有丰富的实时交流功能. 然而有一些老旧的浏览器并不能支持实时猫的功能.

实时猫浏览器检测工具让开发者可以检测用户的浏览器是否支持实时猫提供的各项功能.

安装

如果使用Bower作为包管理器,运行以下命令安装:

bower install realtimecat-rtc-detect --save

在使用包管理软件安装完成后,仍需要在具体HTML页面中,引入下载好的realtimecat-rtc-detect.min.js

如果使用NPM,运行以下命令安装:

npm install realtimecat-rtc-detect --save

本工具同时符合AMD和CommonJS的规范,你可以通过RequireJS或者require('realtimecat-rtc-detect')的方式来调用。

使用

作为window对象

  1. 在HTML中引入realtimecat-rtc-detect.min.js
<script src='dist/realtimecat-rtc-detect.min.js'></script>
  1. 调用RTCDetect的各方法
var output = 'Detecting browsers by RTCDetect:<hr>';
    output += 'Browser: ' + RTCDetect.browser.name + '<br>';
    output += 'Version: ' + RTCDetect.browser.version + '<br>';
    output += 'Full Version: ' + RTCDetect.browser.fullVersion + '<br>';
    output += 'OS Name: ' + RTCDetect.osName + '<br>';
    output += 'Is GetUserMedia Supported: ' + RTCDetect.getUserMediaSupport + '<br>';
    output += 'Is RTCPeerConnection Supported: ' + RTCDetect.RTCPeerConnectionSupport + '<br>';
    output += 'Is DataChannel Supported: ' + RTCDetect.dataChannelSupport + '<br>';
    output += 'Is WebSocket Supported: ' + RTCDetect.WebSocketSupport + '<br>';
    output += 'Is Screen Capturing Supported: ' + RTCDetect.screenCaputringSupport + '<br>';
    output += 'Is ORTC Supported: ' + RTCDetect.ORTCSupport + '<br>';
    output += 'Is RTCat Supported: ' + RTCDetect.RTCatSupport + '<br>';
    document.getElementById('general').innerHTML = output;
    RTCDetect.checkDeviceSupport(function (error, resp) {
        var output = 'Detecting Media Devices by RTCDetect:' + '<br>';
        if (error) {
            output+='Error: ' + error;
            document.getElementById('devices').innerHTML = output;
            return;
        }
        output += 'Has Microphone:' + resp.hasMicrophone + "<br>";
        output += 'Has Speakers:' + resp.hasSpeakers + "<br>";
        output += 'Has Webcam:' + resp.hasWebcam + "<br>";
        output += 'Media Devices:' + '<br>';
        output += '<pre>';
        resp.MediaDevices.forEach(function (item) {
            for (var i in item) {
                output += i + ": " + item[i] + '<br>';
            }
        });
        output += '</pre>';
        document.getElementById('devices').innerHTML = output;
    });

使用Browserify等工具

var RTCDetect = require('realtimecat-rtc-detect');
var output = 'Detecting browsers by RTCDetect:<hr>';
    output += 'Browser: ' + RTCDetect.browser.name + '<br>';
    output += 'Version: ' + RTCDetect.browser.version + '<br>';
    output += 'Full Version: ' + RTCDetect.browser.fullVersion + '<br>';
    output += 'OS Name: ' + RTCDetect.osName + '<br>';
    output += 'Is GetUserMedia Supported: ' + RTCDetect.getUserMediaSupport + '<br>';
    output += 'Is RTCPeerConnection Supported: ' + RTCDetect.RTCPeerConnectionSupport + '<br>';
    output += 'Is DataChannel Supported: ' + RTCDetect.dataChannelSupport + '<br>';
    output += 'Is WebSocket Supported: ' + RTCDetect.WebSocketSupport + '<br>';
    output += 'Is Screen Capturing Supported: ' + RTCDetect.screenCaputringSupport + '<br>';
    output += 'Is ORTC Supported: ' + RTCDetect.ORTCSupport + '<br>';
    output += 'Is RTCat Supported: ' + RTCDetect.RTCatSupport + '<br>';
    document.getElementById('general').innerHTML = output;
    RTCDetect.checkDeviceSupport(function (error, resp) {
        var output = 'Detecting Media Devices by RTCDetect:' + '<br>';
        if (error) {
            output+='Error: ' + error;
            document.getElementById('devices').innerHTML = output;
            return;
        }
        output += 'Has Microphone:' + resp.hasMicrophone + "<br>";
        output += 'Has Speakers:' + resp.hasSpeakers + "<br>";
        output += 'Has Webcam:' + resp.hasWebcam + "<br>";
        output += 'Media Devices:' + '<br>';
        output += '<pre>';
        resp.MediaDevices.forEach(function (item) {
            for (var i in item) {
                output += i + ": " + item[i] + '<br>';
            }
        });
        output += '</pre>';
        document.getElementById('devices').innerHTML = output;
    });