fix
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m31s
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m31s
This commit is contained in:
18
peer.go
18
peer.go
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/gorilla/websocket"
|
||||
@@ -31,6 +30,21 @@ func NewPeer(conn *websocket.Conn, room *Room) *Peer {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// 🔥 ОБЯЗАТЕЛЬНО для SFU
|
||||
_, _ = pc.AddTransceiverFromKind(
|
||||
webrtc.RTPCodecTypeAudio,
|
||||
webrtc.RTPTransceiverInit{
|
||||
Direction: webrtc.RTPTransceiverDirectionSendrecv,
|
||||
},
|
||||
)
|
||||
|
||||
_, _ = pc.AddTransceiverFromKind(
|
||||
webrtc.RTPCodecTypeVideo,
|
||||
webrtc.RTPTransceiverInit{
|
||||
Direction: webrtc.RTPTransceiverDirectionSendrecv,
|
||||
},
|
||||
)
|
||||
|
||||
p := &Peer{
|
||||
ID: uuid.NewString(),
|
||||
Conn: conn,
|
||||
@@ -47,8 +61,6 @@ func NewPeer(conn *websocket.Conn, room *Room) *Peer {
|
||||
})
|
||||
|
||||
pc.OnTrack(func(remote *webrtc.TrackRemote, _ *webrtc.RTPReceiver) {
|
||||
log.Println("track received", remote.Kind())
|
||||
|
||||
local := NewTrack(remote)
|
||||
|
||||
p.Room.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user