❔ Blazor JS Interop - Return RTCPeerConnection from js to Blazor in order to close it

Hi, I've quite a complex task: In my Blazor application I use javascript to read webrtc data produced by https://github.com/deepch/RTSPtoWeb, which basically take streams from a bunch of RTSP IP Cameras and publishes them as webrtc streams. Now, everything works fine, the only problem I have is that, after the webrtc connection is open, at a certain point (e.g. if the user leaves the page) I need to close such connection. In order to establish the connection I use the javascript script provided by the above-mentioned project: https://github.com/deepch/RTSPtoWeb/blob/master/docs/examples/webrtc/main.js, mutatis mutandae. Now, inside the javascript file, the RTCPeerConnection is created by means of
const webrtc = new RTCPeerConnection({
iceServers: [{
urls: ['stun:stun.l.google.com:19302']
}],
sdpSemantics: 'unified-plan'
})
const webrtc = new RTCPeerConnection({
iceServers: [{
urls: ['stun:stun.l.google.com:19302']
}],
sdpSemantics: 'unified-plan'
})
And in order to close it, I suppose I need to return the created 'webrtc' object to the calling Blazor method, so that Blazor side I can close the RTCPeerCOnnection when needed. But Blazor side, I don't know which object I need to use to "store" the result. Do you have any tip about how should I proceed? Thanks
2 Replies
alkasel#159
alkasel#159OP2y ago
From what I understand, I should re-implement the webrtc client in C#. I think I should use the following class. https://microsoft.github.io/MixedReality-WebRTC/manual/cs/cs-peerconnection.html I'm trying but it's not trivial for someone who doesn't completely get how the underlaying things work. Anyone has experience with it?
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server