Commit 2fdb3b37 by haojie

洗稿增加音频时长

parent dde1752c
...@@ -491,12 +491,29 @@ export const onAudioProcessed = async (res: any, liveInfo: any) => { ...@@ -491,12 +491,29 @@ export const onAudioProcessed = async (res: any, liveInfo: any) => {
let resultList = await audioStart([data.audio_address], true); let resultList = await audioStart([data.audio_address], true);
// 转一维 // 转一维
resultList = dimensionalConvert(resultList); resultList = dimensionalConvert(resultList);
let newList = [];
let textScriptList = dimensionalConvert(liveInfo[createLiveKeys.textScriptList]);
for (let $j = 0; $j < resultList.length; $j++) {
let row = resultList[$j];
let param: any = {
content: row.content,
movement_type: textScriptList[i].movement_type ?? '',
movement_name: textScriptList[i].movement_name ?? '',
};
// 获取音频时长
let duration = await getDurationOfAudioFile(row.content);
if (typeof duration === 'number') {
param.duration = parseInt(duration + '');
} else {
param.duration = 0;
}
newList.push(param);
}
if (!resultList.length) { if (!resultList.length) {
show_message('洗稿失败'); show_message('洗稿失败');
writeLog('洗稿回调中音频下载失败-audioStart'); writeLog('洗稿回调中音频下载失败-audioStart');
return; return;
} }
let textScriptList = dimensionalConvert(liveInfo[createLiveKeys.textScriptList]);
list.push({ list.push({
movement: { movement: {
id: textScriptList[i].movement_id, id: textScriptList[i].movement_id,
...@@ -504,13 +521,7 @@ export const onAudioProcessed = async (res: any, liveInfo: any) => { ...@@ -504,13 +521,7 @@ export const onAudioProcessed = async (res: any, liveInfo: any) => {
name: textScriptList[i].movement_name, name: textScriptList[i].movement_name,
url: textScriptList[i].movement_url, url: textScriptList[i].movement_url,
}, },
list: resultList.map((row: any) => { list: newList,
return {
content: row.content,
movement_type: textScriptList[i].movement_type,
movement_name: textScriptList[i].movement_name,
};
}),
}); });
} else { } else {
console.log('洗稿缺少参数'); console.log('洗稿缺少参数');
......
...@@ -8,7 +8,7 @@ const error_messaage = '请求错误'; ...@@ -8,7 +8,7 @@ const error_messaage = '请求错误';
const getBaseUrl = async () => { const getBaseUrl = async () => {
if (isDev()) { if (isDev()) {
return 'http://156.247.11.21:93'; return 'http://rpc.chensav.top';
return ''; return '';
} }
// 默认线上地址 // 默认线上地址
......
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