mirror of
https://github.com/pion/mediadevices.git
synced 2025-10-15 21:20:58 +08:00
Use AddTransceiverFromTrack in examples
Instead of AddTrack.
This commit is contained in:

committed by
Lukas Herman

parent
993c23ee90
commit
0d0c013442
@@ -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 {
|
||||
|
Reference in New Issue
Block a user