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 (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
@@ -31,6 +30,21 @@ func NewPeer(conn *websocket.Conn, room *Room) *Peer {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 🔥 ОБЯЗАТЕЛЬНО для SFU
|
||||||
|
_, _ = pc.AddTransceiverFromKind(
|
||||||
|
webrtc.RTPCodecTypeAudio,
|
||||||
|
webrtc.RTPTransceiverInit{
|
||||||
|
Direction: webrtc.RTPTransceiverDirectionSendrecv,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
_, _ = pc.AddTransceiverFromKind(
|
||||||
|
webrtc.RTPCodecTypeVideo,
|
||||||
|
webrtc.RTPTransceiverInit{
|
||||||
|
Direction: webrtc.RTPTransceiverDirectionSendrecv,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
p := &Peer{
|
p := &Peer{
|
||||||
ID: uuid.NewString(),
|
ID: uuid.NewString(),
|
||||||
Conn: conn,
|
Conn: conn,
|
||||||
@@ -47,8 +61,6 @@ func NewPeer(conn *websocket.Conn, room *Room) *Peer {
|
|||||||
})
|
})
|
||||||
|
|
||||||
pc.OnTrack(func(remote *webrtc.TrackRemote, _ *webrtc.RTPReceiver) {
|
pc.OnTrack(func(remote *webrtc.TrackRemote, _ *webrtc.RTPReceiver) {
|
||||||
log.Println("track received", remote.Kind())
|
|
||||||
|
|
||||||
local := NewTrack(remote)
|
local := NewTrack(remote)
|
||||||
|
|
||||||
p.Room.mu.Lock()
|
p.Room.mu.Lock()
|
||||||
|
|||||||
Reference in New Issue
Block a user