Live video on the AT Protocol
79
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v0.9.1 56 lines 1.5 kB view raw
1package rtcrec 2 3import ( 4 "time" 5 6 "github.com/pion/interceptor" 7 "github.com/pion/rtcp" 8 "github.com/pion/webrtc/v4" 9) 10 11type PeerConnection interface { 12 AddTransceiverFromKind(kind webrtc.RTPCodecType, init ...webrtc.RTPTransceiverInit) (RTPTransceiver, error) 13 Close() error 14 SetRemoteDescription(description webrtc.SessionDescription) error 15 CreateAnswer(options *webrtc.AnswerOptions) (webrtc.SessionDescription, error) 16 SetLocalDescription(description webrtc.SessionDescription) error 17 OnICEConnectionStateChange(func(webrtc.ICEConnectionState)) 18 OnConnectionStateChange(func(webrtc.PeerConnectionState)) 19 OnTrack(func(TrackRemote, RTPReceiver)) 20 // OnDataChannel(func(*webrtc.DataChannel)) 21 // OnNegotiationNeeded(func()) 22 WriteRTCP(pkts []rtcp.Packet) error 23 ICEGatheringState() webrtc.ICEGatheringState 24 LocalDescription() *webrtc.SessionDescription 25} 26 27type RTPTransceiver interface { 28} 29 30type TrackRemote interface { 31 Read(p []byte) (n int, attrs interceptor.Attributes, err error) 32 Kind() webrtc.RTPCodecType 33 PayloadType() webrtc.PayloadType 34 Codec() webrtc.RTPCodecParameters 35 SSRC() webrtc.SSRC 36} 37 38type RTPReceiver interface { 39} 40 41func GatheringCompletePromise(pc PeerConnection) <-chan struct{} { 42 recorder, ok := pc.(*RecordingPeerConnection) 43 if ok { 44 return webrtc.GatheringCompletePromise(recorder.pionpc) 45 } 46 _, ok = pc.(*ReplayPeerConnection) 47 if ok { 48 ch := make(chan struct{}) 49 go func() { 50 <-time.After(100 * time.Millisecond) 51 ch <- struct{}{} 52 }() 53 return ch 54 } 55 panic("unknown peer connection type") 56}