private static async Task <WebRtcSession> SendSDPOffer(WebSocketContext context) { Log.LogDebug($"Web socket client connection from {context.UserEndPoint}."); var webRtcSession = new WebRtcSession( DTLS_CERTIFICATE_FINGERPRINT, _supportedAudioFormats, null, null); webRtcSession.AudioStreamStatus = MediaStreamStatusEnum.SendOnly; webRtcSession.VideoStreamStatus = MediaStreamStatusEnum.SendOnly; webRtcSession.RtpSession.OnReceiveReport += RtpSession_OnReceiveReport; webRtcSession.RtpSession.OnSendReport += RtpSession_OnSendReport; Log.LogDebug($"Sending SDP offer to client {context.UserEndPoint}."); webRtcSession.OnClose += (reason) => { Log.LogDebug($"WebRtcSession was closed with reason {reason}"); OnMediaSampleReady -= webRtcSession.SendMedia; webRtcSession.RtpSession.OnReceiveReport -= RtpSession_OnReceiveReport; webRtcSession.RtpSession.OnSendReport -= RtpSession_OnSendReport; }; await webRtcSession.Initialise(DoDtlsHandshake, null); context.WebSocket.Send(webRtcSession.SDP.ToString()); return(webRtcSession); }
private static async Task <WebRtcSession> SendSDPOffer(WebSocketContext context) { logger.LogDebug($"Web socket client connection from {context.UserEndPoint}."); var webRtcSession = new WebRtcSession(DTLS_CERTIFICATE_FINGERPRINT, null); logger.LogDebug($"Sending SDP offer to client {context.UserEndPoint}."); webRtcSession.OnClose += (reason) => { logger.LogDebug($"WebRtcSession was closed with reason {reason}"); OnMediaSampleReady -= webRtcSession.SendMedia; }; await webRtcSession.Initialise(DoDtlsHandshake, null); context.WebSocket.Send(webRtcSession.SDP); return(webRtcSession); }