RepositoryJavaScriptCNChina
nashaofu

nashaofu/webrtc-demo

webrtc 演示示例

149stars
25forks
1issues
1views

webrtc-demo

webrtc 演示示例,可在预览地址直接使用,或者在https://nashaofu.github.io/webrtc-demo/查看基本显示效果,项目更多介绍可在公众号代码骑行与美食中查看

更多 WebRTC 介绍:https://mp.weixin.qq.com/s/VQwvyaitC1L8noIq5Bnwjw

使用说明

  1. 生成 tls 证书
mkdir tls

cd tls

openssl genrsa -des3 -passout pass:x -out server.pass.key 2048

# writing RSA key
openssl rsa -passin pass:x -in server.pass.key -out server.key

rm server.pass.key

openssl req -new -key server.key -out server.csr

openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
  1. 双击tls/server.crt安装 tls 证书到系统,然后信任该证书。具体参考:https://blog.csdn.net/cuk0051/article/details/108319531

  2. 安装依赖启动服务

yarn

yarn start
  1. 在浏览器中打开终端输出的地址,如遇到证书安全问题可参考https://blog.caojun.xyz/posts/macos_trust_ssl/
  2. index.html 是使用复制文本握手的示例,http.html 是使用 http 建立连接的示例,socket.html 是用来演示 socket 建立连接的示例

webRTC 连接建立流程

webrtc.svg

交换 offer 和 iceCandidata 通常通过 socket 来交换,目的是方便对方网络情况变化后能够推送到参与会话的人,其实这个交换过程也可以用其他任何方式,只要能相互交换信息就可以。例如,A 创建会话后,把自己的 offer 和 iceCandidata 通过邮件发送给 B,B 把这些信息设置到自己的会话中,然后把自己的 offer 和 iceCandidata 发送给 A,只要在这期间网络状况没发生变化,就能够正常通话。关于 webRTC,这篇文章讲得比较不错。

MDN webRTC 连接流程介绍

webRTC-mdn.png

Similar Projects

Discover other similar projects and AI models.

RepositoryJavaScript
muaz-khan/WebRTC-Experiment

WebRTC, WebRTC and WebRTC. Everything here is all about WebRTC!!

12.0k
Jun 15, 2022
RepositoryJavaScript
miroslavpejic85/mirotalk

🚀 Open-source, self-hosted P2P WebRTC video conferencing for fast, private real-time communication. Create browser-based meeting rooms with no downloads or time limits, plus screen sharing, chat, whiteboard, recording, and collaboration.

4.9k
Nov 26, 2026
RepositoryJavaScript
valarpirai/video-chat-app

Simple P2P Text/Voice/Video chat client. Works on Chrome and Firefox, Platforms: Android, Windows, Linux, Mac. Just open the link in Browser, You don't need any extra tools for Video Chat. https://valarpirai.github.io/video-chat-app/

150
Oct 28, 2020
RepositoryTypeScript
morluto/rea

Reverse engineer anything with agents, from app behavior down to native binaries.

487.0k
Dec 2, 2026
RepositoryShell
ohmyzsh/ohmyzsh

🙃 A delightful, community-driven framework for managing your zsh configuration. Built by 2,600+ contributors, with hundreds of plugins (git, rails, laravel, node, python, docker, kubectl, aws, and more), themes to spice up your terminal, and automatic updates to keep your command line feeling like home.

191.0k
Nov 29, 2026
Modelsentence-similarity
sentence-transformers/all-MiniLM-L6-v2

all-MiniLM-L6-v2 This is a sentence-transformers(https://www.SBERT.net) model: It maps sentences & paragraphs to a 384 dimensional dense vector space and can be used for tasks like clustering or semantic search. Usage (Sentence-Transformers) Using t...

♥0
157.6M
Jun 1, 2026
Repository
getify/You-Dont-Know-JS

A book series (2 published editions) on the JS language.

184.8k
Oct 31, 2026
RepositoryPython
harry0703/MoneyPrinterTurbo

利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.

147.3k
Dec 1, 2026
RepositoryJavaScript
affaan-m/ECC

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

315.1k
Dec 1, 2026