diff --git a/examples/simple/main.go b/examples/simple/main.go index 2e8d4ef..8318107 100644 --- a/examples/simple/main.go +++ b/examples/simple/main.go @@ -73,17 +73,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 { diff --git a/examples/transform/main.go b/examples/transform/main.go index fdfb79f..96e9a45 100644 --- a/examples/transform/main.go +++ b/examples/transform/main.go @@ -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 {