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

@lppx/webcamera

v2.1.2

Published

在局域网内实时查看移动设备摄像头的网络应用

Readme

📷 WebCamera

一个基于 Node.js 的局域网实时摄像头传输工具,让你可以轻松地在电脑上查看手机摄像头的实时画面。

✨ 特性

  • 🚀 简单易用:一条命令即可启动服务器
  • 📱 跨设备支持:任何设备都可以访问,手机、平板、电脑通用
  • 🎥 实时传输:基于 Socket.IO 的实时视频流传输
  • 🖥️ 多路查看:查看端可同时查看多个提供端摄像头
  • 🎨 现代化 UI:精美的界面设计,流畅的动画效果
  • 🔒 局域网限制:只在局域网内工作,保护隐私

📦 安装

方式一:使用 npx(推荐)

无需安装,直接运行:

npx @lppx/webcamera start

方式二:全局安装

npm install -g @lppx/webcamera
webcamera start

方式三:本地开发

git clone <repository-url>
cd webcamera
npm install
npm start

🚀 使用方法

1. 启动服务器

npx @lppx/webcamera start

或指定端口:

npx @lppx/webcamera start --port=8080

2. 访问主页

服务器启动后,会自动打开浏览器并显示:

🎥 WebCamera Server Starting...

✅ 服务器已启动!

📡 HTTP 本地地址:   http://localhost:3000
📡 HTTP 局域网地址: http://192.168.1.100:3000

🔒 HTTPS 本地地址:   https://localhost:3443
🔒 HTTPS 局域网地址: https://192.168.1.100:3443

📱 iOS/iPhone 用户请使用 HTTPS 地址访问
💡 首次访问需要在浏览器中接受自签名证书警告

重要

  • 桌面浏览器:可以使用 HTTP 或 HTTPS 地址
  • iOS/iPhone:必须使用 HTTPS 地址(例如 https://192.168.1.100:3443
  • 详细的 iOS 使用指南请查看:iOS 使用指南

3. 选择角色

作为摄像头提供端

  1. 在手机或其他设备上访问局域网地址
  2. 点击「摄像头提供端」按钮
  3. 输入设备名称(可选)
  4. 点击「开启摄像头」
  5. 允许浏览器访问摄像头权限

作为摄像头查看端

  1. 在电脑上访问任意地址(本地或局域网)
  2. 点击「摄像头查看端」按钮
  3. 等待提供端连接
  4. 查看所有在线提供端的摄像头画面

🏗️ 技术栈

  • 后端:Node.js + Express + Socket.IO
  • 前端:原生 HTML + CSS + JavaScript
  • 视频采集:WebRTC getUserMedia API
  • 实时通信:Socket.IO

📁 项目结构

webcamera/
├── src/                    # 源代码
│   ├── cli/                # 命令行界面逻辑
│   ├── server/             # 服务器核心逻辑 (Express, Socket.IO)
│   └── utils/              # 通用工具函数
├── public/                 # 静态资源文件 (HTML, CSS, JS)
├── scripts/                # 辅助脚本
├── package.json            # 项目配置文件
└── README.md               # 项目说明文档

⚙️ 配置选项

命令行参数

  • --port=<端口号>:指定服务器端口(默认:3000)

环境变量

暂不支持环境变量配置,后续版本会添加。

🔧 开发

克隆仓库

git clone <repository-url>
cd webcamera

安装依赖

npm install

启动开发服务器

npm start

发布到 npm

npm publish

📝 注意事项

  1. 网络要求:所有设备必须连接在同一局域网内
  2. iOS HTTPS 要求:iOS/iPhone 设备必须使用 HTTPS 访问才能使用摄像头,服务器会自动启动 HTTPS 服务(端口 3443)
  3. 证书警告:首次使用 HTTPS 访问时需要接受自签名证书警告,这是正常的
  4. 浏览器兼容性:建议使用现代浏览器(Chrome、Firefox、Safari、Edge)
  5. 防火墙:确保防火墙允许对应端口(3000 和 3443)的访问

生成 HTTPS 证书

如果证书不存在或需要重新生成:

npm run generate-cert

🐛 常见问题

iPhone 无法访问摄像头

原因:iOS Safari 要求必须使用 HTTPS 才能访问摄像头

解决方法

  1. 使用 HTTPS 地址访问(例如 https://192.168.1.100:3443
  2. 接受浏览器的证书警告
  3. 允许摄像头权限

详细步骤请参考:iOS 使用指南

无法访问摄像头

  • 检查浏览器是否支持 WebRTC
  • 确认已授予摄像头访问权限
  • 尝试使用 HTTPS 或 localhost

服务器无法启动

  • 检查端口是否被占用
  • 确认 Node.js 版本 >= 14.0.0

摄像头提供端无法连接

  • 确认设备在同一局域网
  • 检查防火墙设置
  • 尝试使用 IP 地址而非主机名

📄 许可证

MIT License

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📮 联系方式

如有问题或建议,请提交 Issue。