From 1a5736808bb3172f8c6ccc4a481ccf78c286643f Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Fri, 22 Dec 2023 12:44:17 -0300 Subject: [PATCH] video-store: Fix non-reactive types related to WebRTC --- src/stores/video.ts | 8 ++++---- src/types/video.ts | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/stores/video.ts b/src/stores/video.ts index c3f52bb9d..cb61d0c3c 100644 --- a/src/stores/video.ts +++ b/src/stores/video.ts @@ -47,8 +47,7 @@ export const useVideoStore = defineStore('video', () => { console.log(`New stream for '${streamName}':`) console.log(JSON.stringify(updatedStream, null, 2)) activateStream(streamName) - // @ts-ignore - activeStreams.value[streamName].stream = updatedStream + activeStreams.value[streamName]!.stream = updatedStream }) }, 300) @@ -63,8 +62,10 @@ export const useVideoStore = defineStore('video', () => { const webRtcManager = new WebRTCManager(webRTCSignallingURI.val, rtcConfiguration) const { mediaStream } = webRtcManager.startStream(stream, allowedIceIps) activeStreams.value[streamName] = { + // @ts-ignore: This is actually not reactive stream: stream, webRtcManager: webRtcManager, + // @ts-ignore: This is actually not reactive mediaStream: mediaStream, } } @@ -78,8 +79,7 @@ export const useVideoStore = defineStore('video', () => { if (activeStreams.value[streamName] === undefined) { activateStream(streamName) } - // @ts-ignore - return activeStreams.value[streamName].mediaStream + return activeStreams.value[streamName]!.mediaStream } // Offer download of backuped videos diff --git a/src/types/video.ts b/src/types/video.ts index ea472fb64..6bef2872e 100644 --- a/src/types/video.ts +++ b/src/types/video.ts @@ -1,5 +1,3 @@ -import type { Ref } from 'vue' - import { WebRTCManager } from '@/composables/webRTC' import type { Stream } from '@/libs/webrtc/signalling_protocol' @@ -10,7 +8,7 @@ export interface StreamData { /** * The actual WebRTC stream */ - stream: Ref + stream: Stream | undefined /** * The responsible for its management */ @@ -18,5 +16,5 @@ export interface StreamData { /** * MediaStream object, if WebRTC stream is chosen */ - mediaStream: Ref + mediaStream: MediaStream | undefined }