From 792b37337b7d7caf44f7c70ccb925ed597047d13 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Fri, 24 Nov 2023 18:27:51 -0300 Subject: [PATCH] Create routine to warn the user if the allowed IPs for the WebRTC ICE candidates were not yet defined --- src/stores/video.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/stores/video.ts b/src/stores/video.ts index e4a6ba8ca..ee2146ee2 100644 --- a/src/stores/video.ts +++ b/src/stores/video.ts @@ -1,10 +1,30 @@ import { useStorage } from '@vueuse/core' import { defineStore } from 'pinia' +import Swal from 'sweetalert2' import { ref } from 'vue' export const useVideoStore = defineStore('video', () => { const availableIceIps = ref(undefined) const allowedIceIps = useStorage('cockpit-allowed-stream-ips', []) + // Routine to make sure the user has chosen the allowed ICE candidate IPs, so the stream works as expected + const iceIpCheckInterval = setInterval(() => { + // Pass if there are no available IPs yet or if the user has already set the allowed ones + if (availableIceIps.value === undefined || !allowedIceIps.value.isEmpty()) { + return + } + // If there's more than one IP candidate available, send a warning an clear the check routine + if (availableIceIps.value.length >= 1) { + Swal.fire({ + text: `Cockpit detected more than one IP being used to route the video streaming. + This situation often leads to video stuterring, specially if one of the IPs is from a non-wired connection. + To prevent issues and have an optimum streaming experience, please open the configuration of one of your + video widgets and choose the IP that should be used for the video streamings.`, + icon: 'warning', + }) + clearInterval(iceIpCheckInterval) + } + }, 5000) + return { availableIceIps, allowedIceIps } })