Skip to content

Commit

Permalink
mini-video-recorder: Auto-assign stream on cold boot if available
Browse files Browse the repository at this point in the history
Let the user know if there were multiple available and we chose one randomly.
  • Loading branch information
rafaellehmkuhl authored and patrickelectric committed Feb 27, 2024
1 parent bfecd2c commit 7aa26ef
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/mini-widgets/MiniVideoRecorder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ const updateCurrentStream = async (streamName: string | undefined): Promise<void
}
const streamConnectionRoutine = setInterval(() => {
// If the video recording widget is cold booted, assign the first stream to it
if (miniWidget.value.options.streamName === undefined && !namesAvailableStreams.value.isEmpty()) {
miniWidget.value.options.streamName = namesAvailableStreams.value[0]
nameSelectedStream.value = miniWidget.value.options.streamName
// If there are multiple streams available, warn user that we chose one automatically and they should change if wanted
if (namesAvailableStreams.value.length > 1) {
const text = `You have multiple streams available, so we chose one randomly to start with.
If you want to change it, please open the widget configuration.`
Swal.fire({ title: 'Multiple streams detected', text: text, icon: 'info', confirmButtonText: 'OK' })
}
}
const updatedMediaStream = videoStore.getMediaStream(miniWidget.value.options.streamName)
// If the widget is not connected to the MediaStream, try to connect it
if (!isEqual(updatedMediaStream, mediaStream.value)) {
Expand Down

0 comments on commit 7aa26ef

Please sign in to comment.