Skip to content

Commit

Permalink
video-store: Fix non-reactive types related to WebRTC
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Dec 23, 2023
1 parent 88acb74 commit 1a57368
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/stores/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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,
}
}
Expand All @@ -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
Expand Down
6 changes: 2 additions & 4 deletions src/types/video.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { Ref } from 'vue'

import { WebRTCManager } from '@/composables/webRTC'
import type { Stream } from '@/libs/webrtc/signalling_protocol'

Expand All @@ -10,13 +8,13 @@ export interface StreamData {
/**
* The actual WebRTC stream
*/
stream: Ref<Stream | undefined>
stream: Stream | undefined
/**
* The responsible for its management
*/
webRtcManager: WebRTCManager
/**
* MediaStream object, if WebRTC stream is chosen
*/
mediaStream: Ref<MediaStream | undefined>
mediaStream: MediaStream | undefined
}

0 comments on commit 1a57368

Please sign in to comment.