mirror of
https://github.com/Monibuca/plugin-webrtc.git
synced 2025-10-04 14:32:42 +08:00
加一些判断
This commit is contained in:
14
main.go
14
main.go
@@ -189,6 +189,10 @@ func (rtc *WebRTC) Publish(streamPath string) bool {
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
Println(err)
|
||||
return false
|
||||
}
|
||||
if _, err = peerConnection.AddTransceiverFromKind(RTPCodecTypeVideo); err != nil {
|
||||
if err != nil {
|
||||
Println(err)
|
||||
@@ -315,13 +319,16 @@ func run() {
|
||||
rtc.s.SetEphemeralUDPPortRange(config.PortMin, config.PortMax)
|
||||
}
|
||||
rtc.api = NewAPI(WithMediaEngine(rtc.m), WithSettingEngine(rtc.s))
|
||||
rtc.PeerConnection, err = rtc.api.NewPeerConnection(Configuration{
|
||||
|
||||
if rtc.PeerConnection, err = rtc.api.NewPeerConnection(Configuration{
|
||||
// ICEServers: []ICEServer{
|
||||
// {
|
||||
// URLs: config.ICEServers,
|
||||
// },
|
||||
// },
|
||||
})
|
||||
}); err != nil {
|
||||
return
|
||||
}
|
||||
rtc.OnICECandidate(func(ice *ICECandidate) {
|
||||
if ice != nil {
|
||||
Println(ice.ToJSON().Candidate)
|
||||
@@ -332,9 +339,6 @@ func run() {
|
||||
// } else {
|
||||
// Println(err)
|
||||
// }
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
rtc.RemoteAddr = r.RemoteAddr
|
||||
if err = rtc.SetRemoteDescription(offer); err != nil {
|
||||
return
|
||||
|
Reference in New Issue
Block a user