Skip to content

Commit d62d5b0

Browse files
stores: video: Send MAVLink message when starting or stopping recording
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
1 parent 8ad4d44 commit d62d5b0

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/stores/video.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { useSnackbar } from '@/composables/snackbar'
1313
import { WebRTCManager } from '@/composables/webRTC'
1414
import { getIpsInformationFromVehicle } from '@/libs/blueos'
1515
import eventTracker from '@/libs/external-telemetry/event-tracking'
16+
import { MavCmd } from '@/libs/connection/m2r/messages/mavlink2rest-enum'
1617
import { availableCockpitActions, registerActionCallback } from '@/libs/joystick/protocols/cockpit-actions'
1718
import {
1819
LiveVideoProcessor,
@@ -44,7 +45,7 @@ export const useVideoStore = defineStore('video', () => {
4445
const alertStore = useAlertStore()
4546
const { showDialog } = useInteractionDialog()
4647

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

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

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

311+
mainVehicle.value?.sendCommandLong(MavCmd.MAV_CMD_VIDEO_STOP_CAPTURE, 0, 0).catch((error) => {
312+
console.warn('Failed to send MAV_CMD_VIDEO_STOP_CAPTURE to vehicle:', error)
313+
})
314+
310315
alertStore.pushAlert(new Alert(AlertLevel.Success, `Stopped recording stream ${streamName}.`))
311316
}
312317

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

606611
alertStore.pushAlert(new Alert(AlertLevel.Success, `Started recording stream ${streamName}.`))
612+
613+
mainVehicle.value?.sendCommandLong(MavCmd.MAV_CMD_VIDEO_START_CAPTURE, 0, 0, 0).catch((error) => {
614+
console.warn('Failed to send MAV_CMD_VIDEO_START_CAPTURE to vehicle:', error)
615+
})
607616
}
608617

609618
// Used to discard a file from the video recovery database

0 commit comments

Comments
 (0)