Skip to content

Commit

Permalink
Add recvonly transceiver for simulcast video
Browse files Browse the repository at this point in the history
Fix one of the layers can't send back video because
the transceiver is used for receiving.
  • Loading branch information
cnderrauber committed Apr 22, 2024
1 parent d9a59a5 commit cbbbc93
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions examples/simulcast/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,18 @@ func main() {
}
outputTracks["f"] = outputTrack

// Add this newly created track to the PeerConnection
if _, err = peerConnection.AddTrack(outputTracks["q"]); err != nil {
if _, err = peerConnection.AddTransceiverFromKind(webrtc.RTPCodecTypeVideo, webrtc.RTPTransceiverInit{Direction: webrtc.RTPTransceiverDirectionRecvonly}); err != nil {
panic(err)
}
if _, err = peerConnection.AddTrack(outputTracks["h"]); err != nil {

// Add this newly created track to the PeerConnection to send back video
if _, err = peerConnection.AddTransceiverFromTrack(outputTracks["q"], webrtc.RTPTransceiverInit{Direction: webrtc.RTPTransceiverDirectionSendonly}); err != nil {
panic(err)
}
if _, err = peerConnection.AddTransceiverFromTrack(outputTracks["h"], webrtc.RTPTransceiverInit{Direction: webrtc.RTPTransceiverDirectionSendonly}); err != nil {
panic(err)
}
if _, err = peerConnection.AddTrack(outputTracks["f"]); err != nil {
if _, err = peerConnection.AddTransceiverFromTrack(outputTracks["f"], webrtc.RTPTransceiverInit{Direction: webrtc.RTPTransceiverDirectionSendonly}); err != nil {
panic(err)
}

Expand Down

0 comments on commit cbbbc93

Please sign in to comment.