Use AddTransceiverFromTrack in examples

Instead of AddTrack.
This commit is contained in:
Atsushi Watanabe
2020-02-14 11:27:24 +09:00
committed by Lukas Herman
parent 993c23ee90
commit 0d0c013442
2 changed files with 10 additions and 12 deletions

View File

@@ -93,17 +93,16 @@ func main() {
fmt.Printf("Track (ID: %s, Label: %s) ended with error: %v\n",
t.ID(), t.Label(), err)
})
_, err = peerConnection.AddTrack(t)
_, err = peerConnection.AddTransceiverFromTrack(t,
webrtc.RtpTransceiverInit{
Direction: webrtc.RTPTransceiverDirectionSendonly,
},
)
if err != nil {
panic(err)
}
}
// Tweak transceiver direction to work with Firefox
for _, t := range peerConnection.GetTransceivers() {
t.Direction = webrtc.RTPTransceiverDirectionSendonly
}
// Set the remote SessionDescription
err = peerConnection.SetRemoteDescription(offer)
if err != nil {