mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
implement OnNegotiationNeeded.
This commit is contained in:
parent
44e74e3088
commit
0075cdca2b
@ -155,6 +155,22 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session, videoID strin
|
||||
iceTrickle: manager.config.ICETrickle,
|
||||
}
|
||||
|
||||
connection.OnNegotiationNeeded(func() {
|
||||
logger.Warn().Msg("negotiation is needed")
|
||||
|
||||
offer, err := peer.CreateOffer(false)
|
||||
if err != nil {
|
||||
logger.Err(err).Msg("sdp offer failed")
|
||||
return
|
||||
}
|
||||
|
||||
session.Send(
|
||||
event.SIGNAL_OFFER,
|
||||
message.SignalDescription{
|
||||
SDP: offer.SDP,
|
||||
})
|
||||
})
|
||||
|
||||
connection.OnConnectionStateChange(func(state webrtc.PeerConnectionState) {
|
||||
switch state {
|
||||
case webrtc.PeerConnectionStateConnected:
|
||||
|
Loading…
Reference in New Issue
Block a user