Commit cf09a225b910571ad1f818581ba18a3074c296d6

Authored by ww
1 parent a49668bf

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

... ... @@ -24,6 +24,8 @@ import { isRtspProtocol } from '/@/components/Video/src/utils';
24 24 import { useFingerprint } from '/@/utils/useFingerprint';
25 25 import { getVideoControlStart } from '/@/api/device/videoChannel';
26 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 30 interface FileItem {
29 31 uid: string;
... ... @@ -642,7 +644,11 @@ export async function getPlayUrl(
642 644 } else if (accessMode === AccessMode.GBT28181) {
643 645 const { deviceId, channelNo } = params?.params || {};
644 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 652 } else {
647 653 const { id, playProtocol } = params;
648 654 const result = await getStreamingPlayUrl(id);
... ...
... ... @@ -58,6 +58,8 @@
58 58 import { stopOnDemandVideoApiGet, syncVideoApiGet } from '/@/api/camera/cameraManager';
59 59 import { Authority } from '/@/components/Authority';
60 60 import { VideoChannelItemType } from '/@/api/device/model/videoChannelModel';
  61 + import { useGlobSetting } from '/@/hooks/setting';
  62 + import { BooleanStringEnum } from '/@/enums/toolEnum';
61 63
62 64 const props = defineProps<{ deviceDetail: DeviceRecord }>();
63 65
... ... @@ -109,7 +111,12 @@
109 111 getPlayUrl: async () => {
110 112 const { deviceId, channelId } = record;
111 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 121 } as VideoCancelModalParamsType,
115 122 });
... ...