|
|
@@ -14,11 +14,17 @@ import type { LiveStreamDTO, PTZAction } from '@/types'
|
|
|
import type { PTZCapabilities, LocalPreset, TimelinePoint } from '../types'
|
|
|
|
|
|
const directionToAction: Record<string, PTZAction> = {
|
|
|
- UP: 'up',
|
|
|
- DOWN: 'down',
|
|
|
- LEFT: 'left',
|
|
|
- RIGHT: 'right',
|
|
|
- STOP: 'stop'
|
|
|
+ up: 'up',
|
|
|
+ down: 'down',
|
|
|
+ left: 'left',
|
|
|
+ right: 'right',
|
|
|
+ up_left: 'up_left',
|
|
|
+ up_right: 'up_right',
|
|
|
+ down_left: 'down_left',
|
|
|
+ down_right: 'down_right',
|
|
|
+ zoom_in: 'zoom_in',
|
|
|
+ zoom_out: 'zoom_out',
|
|
|
+ stop: 'stop'
|
|
|
}
|
|
|
|
|
|
export function usePTZ(
|
|
|
@@ -54,8 +60,8 @@ export function usePTZ(
|
|
|
return
|
|
|
}
|
|
|
try {
|
|
|
- const command = directionToAction[direction] || 'stop'
|
|
|
- const res = await ptzControl({ cameraId, command, speed: ptzSpeed.value })
|
|
|
+ const command = directionToAction[direction]
|
|
|
+ const res = await ptzControl({ cameraId, action: command, speed: ptzSpeed.value })
|
|
|
if (!res.success) {
|
|
|
console.error('PTZ 控制失败', res.errMsg)
|
|
|
}
|