Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/stores/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useBlueOsStorage } from '@/composables/settingsSyncer'
import { useSnackbar } from '@/composables/snackbar'
import { WebRTCManager } from '@/composables/webRTC'
import { getIpsInformationFromVehicle } from '@/libs/blueos'
import { MavCmd } from '@/libs/connection/m2r/messages/mavlink2rest-enum'
import eventTracker from '@/libs/external-telemetry/event-tracking'
import { availableCockpitActions, registerActionCallback } from '@/libs/joystick/protocols/cockpit-actions'
import {
Expand Down Expand Up @@ -44,7 +45,7 @@ export const useVideoStore = defineStore('video', () => {
const alertStore = useAlertStore()
const { showDialog } = useInteractionDialog()

const { globalAddress, rtcConfiguration, webRTCSignallingURI } = useMainVehicleStore()
const { globalAddress, mainVehicle, rtcConfiguration, webRTCSignallingURI } = useMainVehicleStore()
console.debug('[WebRTC] Using webrtc-adapter for', adapter.browserDetails)

const streamsCorrespondency = useBlueOsStorage<VideoStreamCorrespondency[]>('cockpit-streams-correspondency', [])
Expand Down Expand Up @@ -307,6 +308,10 @@ export const useVideoStore = defineStore('video', () => {

activeStreams.value[streamName]!.mediaRecorder!.stop()

mainVehicle.value?.sendCommandLong(MavCmd.MAV_CMD_VIDEO_STOP_CAPTURE, 0, 0).catch((error) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this isn't going to handle individual cameras and streams, it should at least have a TODO comment about doing so. At the moment starting or stopping one recording at the surface would start or stop all the recordings in the vehicle, which is unlikely to be what the user expects (even if it's at least closer to their expectations than the current approach of always recording everything while armed).

console.warn('Failed to send MAV_CMD_VIDEO_STOP_CAPTURE to vehicle:', error)
})

alertStore.pushAlert(new Alert(AlertLevel.Success, `Stopped recording stream ${streamName}.`))
}

Expand Down Expand Up @@ -604,6 +609,10 @@ export const useVideoStore = defineStore('video', () => {
}

alertStore.pushAlert(new Alert(AlertLevel.Success, `Started recording stream ${streamName}.`))

mainVehicle.value?.sendCommandLong(MavCmd.MAV_CMD_VIDEO_START_CAPTURE, 0, 0, 0).catch((error) => {
console.warn('Failed to send MAV_CMD_VIDEO_START_CAPTURE to vehicle:', error)
})
}

// Used to discard a file from the video recovery database
Expand Down
Loading