- 文档要安装git lfs
- 下载当前最新版本1.6.1
windows版本:启动dev模式
服务器启动
(.venv) PS D:\XTRANS\pythonProject\LIVEKIT> cd .\livekit_release\
(.venv) PS D:\XTRANS\pythonProject\LIVEKIT\livekit_release> lsDirectory: D:\XTRANS\pythonProject\LIVEKIT\livekit_releaseMode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 5/29/2024 11:20 21477249 livekit-cli_1.4.3_windows_amd64.zip
-a---- 4/27/2024 03:11 29753856 livekit-server.exe
-a---- 5/29/2024 11:17 10440081 livekit_1.6.1_windows_amd64.zip(.venv) PS D:\XTRANS\pythonProject\LIVEKIT\livekit_release> .\livekit-server.exe -dev
2024-05-29T11:29:40.070+0800 INFO livekit server/main.go:208 starting in development mode
2024-05-29T11:29:40.071+0800 INFO livekit server/main.go:211 no keys provided, using placeholder keys {"API Key": "devkey", "API Secret": "secret"}
2024-05-29T11:29:40.071+0800 ERROR livekit hwstats/cpu_null.go:37 CPU monitoring unsupported on current platform. Server capacity management will be disabled
github.com/livekit/protocol/utils/hwstats.newPlatformCPUMonitor/home/runner/go/pkg/mod/github.com/livekit/protocol@v1.14.1-0.20240426104403-e7962f444464/utils/hwstats/cpu_null.go:37
github.com/livekit/protocol/utils/hwstats.NewCPUStats/home/runner/go/pkg/mod/github.com/livekit/protocol@v1.14.1-0.20240426104403-e7962f444464/utils/hwstats/cpu.go:46
github.com/livekit/livekit-server/pkg/telemetry/prometheus.Init/home/runner/go/pkg/mod/github.com/livekit/livekit-server@v1.6.1/pkg/telemetry/prometheus/node.go:119
main.startServer/home/runner/go/pkg/mod/github.com/livekit/livekit-server@v1.6.1/cmd/server/main.go:275
github.com/urfave/cli/v2.(*Command).Run/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:279
github.com/urfave/cli/v2.(*App).RunContext/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:337
github.com/urfave/cli/v2.(*App).Run/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:311
main.main/home/runner/go/pkg/mod/github.com/livekit/livekit-server@v1.6.1/cmd/server/main.go:185
runtime.main/opt/hostedtoolcache/go/1.22.2/x64/src/runtime/proc.go:271
2024-05-29T11:29:40.072+0800 INFO livekit routing/interfaces.go:110 using single-node routing
2024-05-29T11:29:40.128+0800 INFO livekit service/server.go:243 starting LiveKit server {"portHttp": 7880, "nodeID": "ND_5fUotUdPwB5P", "nodeIP": "169.254.25.153", "version": "1.6.1", "bindAddresses": ["127.0.0.1", "::1"], "rtc.portTCP": 7881, "rtc.portUDP": {"Start":7882,"End":0}}
2024-05-29T11:29:40.129+0800 INFO livekit service/server.go:245 Windows detected, capacity management is unavailable
2024-05-29T11:29:40.129+0800 DEBUG livekit service/signal.go:122 starting relay signal server {"topic": "ND_5fUotUdPwB5P"}
命令行配置工具启动并创建
(.venv) PS D:\XTRANS\pythonProject\LIVEKIT\livekit_release> .\livekit-cli.exe create-token --api-key devkey --api-secret secret --join --room my-first-room --identity user1 --valid-for 24h
valid for (mins): 1440
token grants
{"roomJoin": true,"room": "my-first-room"
}access token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTcwNDAyNTUsImlzcyI6ImRldmtleSIsIm5hbWUiOiJ1c2VyMSIsIm5iZiI6MTcxNjk1Mzg1NSwic3ViIjoidXNlcjEiLCJ2aWRlbyI6eyJyb29tIjoibXktZmlyc3Qtcm9vbSIsInJvb21Kb2luIjp0cnVlfX0.7Dp4eEO6PL-wgfohVYpk5PikMe-ANTnVzz9FCxwxQqA
(.venv) PS D:\XTRANS\pythonProject\LIVEKIT\livekit_release>
有example app 做测试
- test with example app
- 输入一个访问token:
access token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTcwNDAyNTUsImlzcyI6ImRldmtleSIsIm5hbWUiOiJ1c2VyMSIsIm5iZiI6MTcxNjk1Mzg1NSwic3ViIjoidXNlcjEiLCJ2aWRlbyI6eyJyb29tIjoibXktZmlyc3Qtcm9vbSIsInJvb21Kb2luIjp0cnVlfX0.7Dp4eEO6PL-wgfohVYpk5PikMe-ANTnVzz9FCxwxQqA
- 然后connect 到 自己的服务器 。
Head over to our example app and enter a generated token to connect to your LiveKit server. This app is built with our React SDK.
Once connected, your video and audio are now being published to your new LiveKit instance!
- 服务器的地址填啥啊:
wss://127.0.0.1:7880
测试服务只有http端口:ws://127.0.0.1:7880
连接成功
connecting to ws://127.0.0.1:7880/rtc?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTcwNDAyNTUsImlzcyI6ImRldmtleSIsIm5hbWUiOiJ1c2VyMSIsIm5iZiI6MTcxNjk1Mzg1NSwic3ViIjoidXNlcjEiLCJ2aWRlbyI6eyJyb29tIjoibXktZmlyc3Qtcm9vbSIsInJvb21Kb2luIjp0cnVlfX0.7Dp4eEO6PL-wgfohVYpk5PikMe-ANTnVzz9FCxwxQqA&auto_subscribe=1&sdk=js&version=2.1.5&protocol=13&adaptive_stream=1
ping
连接到livkit服务
房间
音频track
-
视频track
屏幕共享
收到了服务端发来的offer
"v=0
o=- 3539670089777133376 1716954452 IN IP4 0.0.0.0
s=-
t=0 0
a=msid-semantic:WMS*
a=fingerprint:sha-256 45:14:D4:79:B6:18:BA:9B:34:F1:CF:DA:66:AA:EA:07:83:5B:A3:5A:C5:46:47:D8:94:DB:26:F5:CD:B7:4C:E3
a=extmap-allow-mixed
a=group:BUNDLE 0
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=setup:actpass
a=mid:0
a=sendrecv
a=sctp-port:5000
a=ice-ufrag:gSTaoeYEXVclkirW
a=ice-pwd:eiWMcXuxMaLrXfPGjLYwBvZwejtSHAZE
"
设置本地SDP
发送answer
"v=0
o=- 8490693211729429077 2 IN IP4 127.0.0.1
s=-
t=0 0
a=extmap-allow-mixed
a=msid-semantic: WMS
a=group:BUNDLE 0
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=setup:active
a=mid:0
a=ice-ufrag:+brm
a=ice-pwd:g3FGDMFwFFY2tLEzG3v+WKOh
a=fingerprint:sha-256 37:9B:7C:99:8D:13:69:06:B5:D5:66:C0:67:3E:C0:BC:21:B3:A7:68:7C:B1:03:E5:8C:24:C0:52:06:B9:F7:28
a=ice-options:trickle
a=sctp-port:5000
"
pc状态改变:从new 到连接ing
主要pc状态改变
pc状态从connecting到connectd
主要pc状态改变2
更新track的订阅权限
datachannel1 : reliable
datachanel3 : lossy
room event : 状态改变为connected
发布一个track publishing track
收到了track发布应答 received trackPublishedResponse
更新发布信息 、track信息
发布音频:携带编码信息
开始协商
开始 munged 本地描述
发送offer
"v=0
o=- 8396030922318899904 2 IN IP4 127.0.0.1
s=-
t=0 0
a=extmap-allow-mixed
a=msid-semantic: WMS 8d171c18-977d-4ba2-b592-97e1a7f62532
a=group:BUNDLE 0 1
m=audio 9 UDP/TLS/RTP/SAVPF 111 63 9 0 8 13 110 126
c=IN IP4 0.0.0.0
a=rtpmap:111 opus/48000/2
a=rtpmap:63 red/48000/2
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:126 telephone-event/8000
a=fmtp:111 minptime=10;useinbandfec=1
a=fmtp:63 111/111
a=rtcp:9 IN IP4 0.0.0.0
a=rtcp-fb:111 transport-cc
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=setup:actpass
a=mid:0
a=msid:8d171c18-977d-4ba2-b592-97e1a7f62532 6626e558-44bc-4a1a-a364-173503f39c02
a=sendonly
a=ice-ufrag:Os7Y
a=ice-pwd:uh13Zyrm3ScOX1g1/OpRacbx
a=fingerprint:sha-256 DA:09:84:61:32:BA:B7:99:54:2D:1D:B5:F6:F0:DE:10:45:2F:66:0B:D2:6B:F6:B7:B4:62:7C:19:17:DC:D6:74
a=ice-options:trickle
a=ssrc:3723991868 cname:5f/brAKhc+jUMDn7
a=ssrc:3723991868 msid:8d171c18-977d-4ba2-b592-97e1a7f62532 6626e558-44bc-4a1a-a364-173503f39c02
a=rtcp-mux
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 0.0.0.0
a=setup:actpass
a=mid:1
a=ice-ufrag:Os7Y
a=ice-pwd:uh13Zyrm3ScOX1g1/OpRacbx
a=fingerprint:sha-256 DA:09:84:61:32:BA:B7:99:54:2D:1D:B5:F6:F0:DE:10:45:2F:66:0B:D2:6B:F6:B7:B4:62:7C:19:17:DC:D6:74
a=ice-options:trickle
a=sctp-port:5000
a=max-message-size:262144
"