Chinanashaofu/webrtc-demo
webrtc 演示示例
webrtc-demo
webrtc 演示示例,可在预览地址直接使用,或者在https://nashaofu.github.io/webrtc-demo/查看基本显示效果,项目更多介绍可在公众号代码骑行与美食中查看
更多 WebRTC 介绍:https://mp.weixin.qq.com/s/VQwvyaitC1L8noIq5Bnwjw
使用说明
- 生成 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
-
双击
tls/server.crt安装 tls 证书到系统,然后信任该证书。具体参考:https://blog.csdn.net/cuk0051/article/details/108319531 -
安装依赖启动服务
yarn
yarn start
- 在浏览器中打开终端输出的地址,如遇到证书安全问题可参考https://blog.caojun.xyz/posts/macos_trust_ssl/
- index.html 是使用复制文本握手的示例,http.html 是使用 http 建立连接的示例,socket.html 是用来演示 socket 建立连接的示例
webRTC 连接建立流程
交换 offer 和 iceCandidata 通常通过 socket 来交换,目的是方便对方网络情况变化后能够推送到参与会话的人,其实这个交换过程也可以用其他任何方式,只要能相互交换信息就可以。例如,A 创建会话后,把自己的 offer 和 iceCandidata 通过邮件发送给 B,B 把这些信息设置到自己的会话中,然后把自己的 offer 和 iceCandidata 发送给 A,只要在这期间网络状况没发生变化,就能够正常通话。关于 webRTC,这篇文章讲得比较不错。
MDN webRTC 连接流程介绍

Similar Projects
Discover other similar projects and AI models.
WebRTC, WebRTC and WebRTC. Everything here is all about WebRTC!!
🚀 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.
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/
Reverse engineer anything with agents, from app behavior down to native binaries.
🙃 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.
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...
利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.
The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.