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) {
31
31
playbackAbortController: AbortController | null = null
32
32
sleepAbortController: AbortController | null = null
33
33
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
35
35
36
36
async loadStream () {
37
37
this .pc ?.close ()
@@ -58,7 +58,8 @@ export default class WebrtcCamerastreamerCamera extends Mixins(CameraMixin) {
58
58
' stun:stun.l.google.com:19302'
59
59
]
60
60
}
61
- ]
61
+ ],
62
+ keepAlive: true
62
63
}),
63
64
headers: {
64
65
' Content-Type' : ' application/json'
@@ -83,6 +84,16 @@ export default class WebrtcCamerastreamerCamera extends Mixins(CameraMixin) {
83
84
84
85
const pc = this .pc = new RTCPeerConnection (config )
85
86
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
+
86
97
pc .addTransceiver (' video' , {
87
98
direction: ' recvonly'
88
99
})
You can’t perform that action at this time.
0 commit comments