Commit bc92c32b authored by 陈龙's avatar 陈龙

fix: 修复视频地址设置加密导致的bug

parent eb47f50e
Pipeline #95073 failed with stages
......@@ -134,14 +134,6 @@ const AddModal = props => {
}
});
};
const returnVideoListArr = (str, serialNum, numStr) => {
let _arr = numStr.split(',');
return _arr.map((item, index) => {
return str.replace(new RegExp(`\/${serialNum}_\\d_\\d\\.((flv)|(m3u8))`), (match) => {
return match.replace(/_\d_/, `_${item}_`);
})
})
}
const getVideoUrl = () => {
let _values = form.getFieldsValue();
const {EquipmentNumber, LoginName, LoginPwd, PassageId} = _values;
......@@ -156,20 +148,23 @@ const AddModal = props => {
getYSYVideoSource({
deviceSerial: _values.EquipmentNumber, // 设备序列号
appKey: _values.LoginName,
appSecret: _values.LoginPwd,
channelNo: _NO,
protocol: '2,4' // 2是hls,直播流;4是flv,是轻应用
appSecret: _values?.LoginPwd?.length === 32 ? _values?.LoginPwd : Decrypt(_values.LoginPwd),
channelNo: _values?.PassageId,
protocol: '2,4', // 2是hls,直播流;4是flv,是轻应用
}).then(res => {
if (!res?.getMe?.length) return message.warning('无法获取视频链接,请前往萤石云确认设备是否在线、配置是否正确有效!')
let flvStr = '';
let hlsStr = '';
let flvArr = [];
let hlsArr = [];
res.getMe.forEach((item) => {
if (item.protocol === 2) hlsStr = item?.liveAddress?.[0];
if (item.protocol === 4) flvStr = item?.liveAddress?.[0];
if (item.protocol === 2) hlsArr = item?.liveAddress ?? [];
if (item.protocol === 4) flvArr = item?.liveAddress ?? [];
});
form.setFieldsValue({
...obj,
LoginPwd: obj.LoginPwd ? Decrypt(obj.LoginPwd) : '',
'VideoPath': flvArr.join(','),
'HLSPath': hlsArr.join(',')
});
let _flv = returnVideoListArr(flvStr, EquipmentNumber, PassageId);
let _hls = returnVideoListArr(hlsStr, EquipmentNumber, PassageId);
form.setFieldsValue({...obj, 'VideoPath': _flv.join(','), 'HLSPath': _hls.join(',')});
}).catch(err => {
if (err.message.includes('Request failed with status code 404')) return message.warning('当前平台无法自动获取萤石云视频,如有需要,请联系管理员!');
message.warning('萤石云网络波动,获取失败。请重试或前往萤石云平台手动获取!')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment