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 🙏

© 2026 – Pkg Stats / Ryan Hefner

webrtclib

v0.1.10

Published

a webrtc lib for vue

Readme

webrtclib

一个webrtc的vue前端实现,支持截图和录像,后端代码暂未发布

npm导入

npm install webrtclib

引入组件

import videoWebrtc from "webrtclib";
import "webrtclib/lib/videoWebrtc.css"

Vue.use(videoWebrtc);

使用

<video-webrtc
        :server="server"
        :stun="stun"
        :sid="sid"
        :orgId="orgId"
        @saveVideo="saveVideo"
        @capture="capture"
      ></video-webrtc>

参数说明

| 参数 | 类型 | 类型 | 解释 | | ---- | ---- | ---- | ---- | | server | 必传 | String | 服务地址 | | stun | 必传 | String | ice协议服务地址 | | sid | 必传 | [Number, String] | 直播时候传入的设备id | | orgId | 必传 | [Number, String] | 直播时候传入的组织ID | | custTime | 非必传 | [Number, String] | 录像时间(秒),默认5分钟,最大1小时 | | saveVideo | 非必传 | 回调方法 | 返回录像地址url | | capture | 非必传 | 回调方法 | 返回截图文件base64 |

tips

录像需要配置proxy

 proxy: {
      "/webrtcApi": {
        target: "http://ip:port", // 目标接口域名
        pathRewrite: {
          "^/webrtcApi": ""
        },
        changeOrigin: true // 是否跨域
      }
    }

demo参考

<template>
  <div class="home">
    <div class="video" v-for="item in arr" :key="item">
      <video-webrtc
        :server="server"
        :stun="stun"
        :sid="sid"
        :orgId="orgId"
        @saveVideo="saveVideo"
        @capture="capture"
      ></video-webrtc>
    </div>
    <div class="dialog-mask" v-if="imgCapture" @click="imgCapture = null"></div>
    <div class="dilog" v-if="imgCapture">
      <img v-if="imgCapture" :src="imgCapture" alt="" />
    </div>
  </div>
</template>

<script>
export default {
  name: "Home",
  data() {
    return {
      arr: [1, 2, 3, 4, 5, 6, 7, 8, 9],
      stun: "stun://ip:port",
      server: "ws://ip:port/wsrtc",
      sid: "摄像头ID",
      orgId: "组织ID"
      imgCapture: ""
    };
  },
  methods: {
    // 截图
    capture(val) {
      console.log(val);
      this.imgCapture = val;
    },
    // 录像
    saveVideo(val) {
      console.log(val);
    }
  }
};
</script>
<style>
.home {
  display: flex;
  flex-wrap: wrap;
}
.video {
  width: 320px;
  height: 180px;
  position: relative;
  margin: 10px;
}
.dialog-mask {
  position: absolute;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: #00000090;
}
.dilog {
  position: absolute;
  z-index: 1001;
  width: 80%;
  left: 10%;
  top: 10%;
  padding: 20px;
  background-color: #fff;
}
</style>