File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
src/components/widgets/camera/services Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export default class WebrtcCamerastreamerCamera extends Mixins(CameraMixin) {
3131 playbackAbortController: AbortController | null = null
3232 sleepAbortController: AbortController | null = null
3333
34- // adapted from https://github.com/ayufan/camera-streamer/blob/4203f89df1596cc349b0260f26bf24a3c446a56b /html/webrtc.html
34+ // adapted from https://github.com/ayufan/camera-streamer/blob/2d3a4884378f384346680a55196bf9244b99b6b6 /html/webrtc.html
3535
3636 async loadStream () {
3737 this .pc ?.close ()
@@ -58,7 +58,8 @@ export default class WebrtcCamerastreamerCamera extends Mixins(CameraMixin) {
5858 ' stun:stun.l.google.com:19302'
5959 ]
6060 }
61- ]
61+ ],
62+ keepAlive: true
6263 }),
6364 headers: {
6465 ' Content-Type' : ' application/json'
@@ -83,6 +84,16 @@ export default class WebrtcCamerastreamerCamera extends Mixins(CameraMixin) {
8384
8485 const pc = this .pc = new RTCPeerConnection (config )
8586
87+ pc .ondatachannel = (event : RTCDataChannelEvent ) => {
88+ const dc = event .channel
89+
90+ if (dc .label === ' keepalive' ) {
91+ dc .onmessage = () => {
92+ dc .send (' pong' )
93+ }
94+ }
95+ }
96+
8697 pc .addTransceiver (' video' , {
8798 direction: ' recvonly'
8899 })
You can’t perform that action at this time.
0 commit comments