Commit cf09a225b910571ad1f818581ba18a3074c296d6

Authored by ww
1 parent a49668bf

fix: 修复GBT28181获取视频流地址时区分http与https环境

@@ -24,6 +24,8 @@ import { isRtspProtocol } from '/@/components/Video/src/utils'; @@ -24,6 +24,8 @@ import { isRtspProtocol } from '/@/components/Video/src/utils';
24 import { useFingerprint } from '/@/utils/useFingerprint'; 24 import { useFingerprint } from '/@/utils/useFingerprint';
25 import { getVideoControlStart } from '/@/api/device/videoChannel'; 25 import { getVideoControlStart } from '/@/api/device/videoChannel';
26 import { StreamType as PlayerStreamType } from '/@/components/Video/src/types'; 26 import { StreamType as PlayerStreamType } from '/@/components/Video/src/types';
  27 +import { useGlobSetting } from '/@/hooks/setting';
  28 +import { BooleanStringEnum } from '/@/enums/toolEnum';
27 29
28 interface FileItem { 30 interface FileItem {
29 uid: string; 31 uid: string;
@@ -642,7 +644,11 @@ export async function getPlayUrl( @@ -642,7 +644,11 @@ export async function getPlayUrl(
642 } else if (accessMode === AccessMode.GBT28181) { 644 } else if (accessMode === AccessMode.GBT28181) {
643 const { deviceId, channelNo } = params?.params || {}; 645 const { deviceId, channelNo } = params?.params || {};
644 const result = await getVideoControlStart({ channelId: channelNo!, deviceId: deviceId! }); 646 const result = await getVideoControlStart({ channelId: channelNo!, deviceId: deviceId! });
645 - return { url: result.data.flv, type: 'flv' }; 647 + const { securityPolicy } = useGlobSetting();
  648 + return {
  649 + url: securityPolicy === BooleanStringEnum.TRUE ? result.data.https_flv : result.data.flv,
  650 + type: 'flv',
  651 + };
646 } else { 652 } else {
647 const { id, playProtocol } = params; 653 const { id, playProtocol } = params;
648 const result = await getStreamingPlayUrl(id); 654 const result = await getStreamingPlayUrl(id);
@@ -58,6 +58,8 @@ @@ -58,6 +58,8 @@
58 import { stopOnDemandVideoApiGet, syncVideoApiGet } from '/@/api/camera/cameraManager'; 58 import { stopOnDemandVideoApiGet, syncVideoApiGet } from '/@/api/camera/cameraManager';
59 import { Authority } from '/@/components/Authority'; 59 import { Authority } from '/@/components/Authority';
60 import { VideoChannelItemType } from '/@/api/device/model/videoChannelModel'; 60 import { VideoChannelItemType } from '/@/api/device/model/videoChannelModel';
  61 + import { useGlobSetting } from '/@/hooks/setting';
  62 + import { BooleanStringEnum } from '/@/enums/toolEnum';
61 63
62 const props = defineProps<{ deviceDetail: DeviceRecord }>(); 64 const props = defineProps<{ deviceDetail: DeviceRecord }>();
63 65
@@ -109,7 +111,12 @@ @@ -109,7 +111,12 @@
109 getPlayUrl: async () => { 111 getPlayUrl: async () => {
110 const { deviceId, channelId } = record; 112 const { deviceId, channelId } = record;
111 const result = await getVideoControlStart({ deviceId, channelId }); 113 const result = await getVideoControlStart({ deviceId, channelId });
112 - return { type: 'flv', url: result.data.flv }; 114 + const { securityPolicy } = useGlobSetting();
  115 + return {
  116 + type: 'flv',
  117 + url:
  118 + securityPolicy === BooleanStringEnum.TRUE ? result.data.https_flv : result.data.flv,
  119 + };
113 }, 120 },
114 } as VideoCancelModalParamsType, 121 } as VideoCancelModalParamsType,
115 }); 122 });