diff --git a/src/stores/video.ts b/src/stores/video.ts index 74a18f7527..778c801bf5 100644 --- a/src/stores/video.ts +++ b/src/stores/video.ts @@ -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 { @@ -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('cockpit-streams-correspondency', []) @@ -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) => { + console.warn('Failed to send MAV_CMD_VIDEO_STOP_CAPTURE to vehicle:', error) + }) + alertStore.pushAlert(new Alert(AlertLevel.Success, `Stopped recording stream ${streamName}.`)) } @@ -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