Commit 932ca5f631acb9a23465f44ae09c804d4889f423
Merge branch 'fix/rtsp-transform' into 'main_dev'
fix: 修复rtsp播放流转换需要携带token See merge request yunteng/thingskit-front!1425
Showing
3 changed files
with
19 additions
and
15 deletions
... | ... | @@ -92,10 +92,11 @@ |
92 | 92 | const { getResult } = useFingerprint(); |
93 | 93 | const beforeVideoPlay = async (record: CameraRecordItem) => { |
94 | 94 | if (isNullOrUnDef(record.accessMode)) return; |
95 | - const { url, type } = await getPlayUrl(record); | |
95 | + const { url, type, withToken } = (await getPlayUrl(record)) || {}; | |
96 | 96 | record.playSourceUrl = url; |
97 | 97 | record.streamType = type; |
98 | 98 | record.isTransform = true; |
99 | + record.withToken = withToken; | |
99 | 100 | }; |
100 | 101 | |
101 | 102 | const gridLayout = ref({ gutter: 1, column: 2 }); | ... | ... |
... | ... | @@ -632,9 +632,7 @@ export const formGBTSchema: QFormSchema[] = [ |
632 | 632 | }, |
633 | 633 | ]; |
634 | 634 | |
635 | -export async function getPlayUrl( | |
636 | - params: CameraRecord | |
637 | -): Promise<{ url: string; type: PlayerStreamType }> { | |
635 | +export async function getPlayUrl(params: CameraRecord) { | |
638 | 636 | const { accessMode } = params; |
639 | 637 | if (accessMode === AccessMode.ManuallyEnter) { |
640 | 638 | const { videoUrl } = params; |
... | ... | @@ -644,7 +642,11 @@ export async function getPlayUrl( |
644 | 642 | if (isRTSPPlay) { |
645 | 643 | const { getResult } = useFingerprint(); |
646 | 644 | const fingerprint = await getResult(); |
647 | - return { url: getFlvPlayUrl(videoUrl, fingerprint.visitorId), type: 'flv' }; | |
645 | + return { | |
646 | + url: getFlvPlayUrl(videoUrl, fingerprint.visitorId), | |
647 | + type: 'flv', | |
648 | + withToken: true, | |
649 | + }; | |
648 | 650 | } else { |
649 | 651 | return { url: videoUrl, type: 'auto' }; |
650 | 652 | } | ... | ... |
... | ... | @@ -30,16 +30,17 @@ |
30 | 30 | const { config } = props; |
31 | 31 | const { option } = config; |
32 | 32 | const { videoConfig, uuid } = option || {}; |
33 | - const { type, url } = await getPlayUrl({ | |
34 | - id: videoConfig?.id, | |
35 | - accessMode: videoConfig?.accessMode, | |
36 | - playProtocol: videoConfig?.playProtocol, | |
37 | - videoUrl: videoConfig?.videoUrl, | |
38 | - params: { | |
39 | - deviceId: videoConfig?.deviceId, | |
40 | - channelNo: videoConfig?.channelId, | |
41 | - }, | |
42 | - } as unknown as CameraRecord); | |
33 | + const { type, url } = | |
34 | + (await getPlayUrl({ | |
35 | + id: videoConfig?.id, | |
36 | + accessMode: videoConfig?.accessMode, | |
37 | + playProtocol: videoConfig?.playProtocol, | |
38 | + videoUrl: videoConfig?.videoUrl, | |
39 | + params: { | |
40 | + deviceId: videoConfig?.deviceId, | |
41 | + channelNo: videoConfig?.channelId, | |
42 | + }, | |
43 | + } as unknown as CameraRecord)) || {}; | |
43 | 44 | playType.value = type; |
44 | 45 | playUrl.value = url; |
45 | 46 | if (!uuid) return; | ... | ... |