Commit 0a81a6142b72944f2c9b10997fd137da07c7f0b8

Authored by xp.Huang
1 parent efc1517c

Merge branch 'fix/video-stream-url' into 'main_dev'

Fix/video stream url

See merge request yunteng/thingskit-front!1330

(cherry picked from commit c8fb7e56)

cf09a225 fix: 修复GBT28181获取视频流地址时区分http与https环境
ec8ac744 perf: 优化securityPolicy取值判断
@@ -24,6 +24,9 @@ import { isRtspProtocol } from '/@/components/Video/src/utils'; @@ -24,6 +24,9 @@ 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';
  29 +import { isBoolean } from '/@/utils/is';
27 30
28 interface FileItem { 31 interface FileItem {
29 uid: string; 32 uid: string;
@@ -642,7 +645,13 @@ export async function getPlayUrl( @@ -642,7 +645,13 @@ export async function getPlayUrl(
642 } else if (accessMode === AccessMode.GBT28181) { 645 } else if (accessMode === AccessMode.GBT28181) {
643 const { deviceId, channelNo } = params?.params || {}; 646 const { deviceId, channelNo } = params?.params || {};
644 const result = await getVideoControlStart({ channelId: channelNo!, deviceId: deviceId! }); 647 const result = await getVideoControlStart({ channelId: channelNo!, deviceId: deviceId! });
645 - return { url: result.data.flv, type: 'flv' }; 648 + const { securityPolicy } = useGlobSetting();
  649 + return {
  650 + url: (isBoolean(securityPolicy) ? securityPolicy : securityPolicy === BooleanStringEnum.TRUE)
  651 + ? result.data.https_flv
  652 + : result.data.flv,
  653 + type: 'flv',
  654 + };
646 } else { 655 } else {
647 const { id, playProtocol } = params; 656 const { id, playProtocol } = params;
648 const result = await getStreamingPlayUrl(id); 657 const result = await getStreamingPlayUrl(id);
@@ -58,6 +58,9 @@ @@ -58,6 +58,9 @@
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';
  63 + import { isBoolean } from '/@/utils/is';
61 64
62 const props = defineProps<{ deviceDetail: DeviceRecord }>(); 65 const props = defineProps<{ deviceDetail: DeviceRecord }>();
63 66
@@ -109,7 +112,15 @@ @@ -109,7 +112,15 @@
109 getPlayUrl: async () => { 112 getPlayUrl: async () => {
110 const { deviceId, channelId } = record; 113 const { deviceId, channelId } = record;
111 const result = await getVideoControlStart({ deviceId, channelId }); 114 const result = await getVideoControlStart({ deviceId, channelId });
112 - return { type: 'flv', url: result.data.flv }; 115 + const { securityPolicy } = useGlobSetting();
  116 + return {
  117 + type: 'flv',
  118 + url: (
  119 + isBoolean(securityPolicy) ? securityPolicy : securityPolicy === BooleanStringEnum.TRUE
  120 + )
  121 + ? result.data.https_flv
  122 + : result.data.flv,
  123 + };
113 }, 124 },
114 } as VideoCancelModalParamsType, 125 } as VideoCancelModalParamsType,
115 }); 126 });