client,proxy: add a media channel

This commit is contained in:
KokaKiwi 2025-08-09 14:11:54 +02:00
parent 70974640ab
commit 0a7291e90f
No known key found for this signature in database
GPG key ID: FD333F84686EFE78
3 changed files with 70 additions and 0 deletions

View file

@ -451,6 +451,19 @@ func (sf *SnowflakeProxy) makePeerConnectionFromOffer(
return nil, fmt.Errorf("accept: NewPeerConnection: %s", err)
}
pc.OnTrack(func(remote *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) {
log.Printf("Track has started streamId(%s) id(%s) rid(%s) \n", remote.StreamID(), remote.ID(), remote.RID())
for {
rtcpBuf := make([]byte, 1500)
for {
if _, _, err := receiver.Read(rtcpBuf); err != nil {
return
}
}
}
})
pc.OnDataChannel(func(dc *webrtc.DataChannel) {
log.Printf("New Data Channel %s-%d\n", dc.Label(), dc.ID())
close(dataChan)