Commit 251b45e6 by haojie

修改type_content的格式

parent 61ec95a3
......@@ -8,7 +8,7 @@
ref="videoFirst"
class="video-default"
:src="item.url"
:loop="getLoopStatus(item)"
:loop="loop"
@canplay="mainVideoCanplay(index)"
@ended="firstVideoEnded(index)"
></video>
......@@ -107,17 +107,6 @@ const secondVideoVolume = ref(initVolume);
let interval = null;
// 是否循环播放
const getLoopStatus = (item: any) => {
if (loop.value) {
return true;
} else {
return false;
// loop为false
// if
}
};
// 离开前先关闭弹窗
onBeforeRouteLeave((to, from, next) => {
confirmVisible.value = false;
......@@ -211,6 +200,8 @@ const firstVideoEnded = (index: number) => {
videoKey: 'status',
videoValue: true,
});
// 强制关闭自己的播放状态,防止loop生效
videoFirst.value[currentPlayMainIndex.value].pause();
nextVideoToPlay();
}
......
......@@ -84,6 +84,16 @@ export const processTextCallback = () => {
if (item[createLiveKeys.scriptType] == scriptTypeText) {
// 文本
params.type_content = item[createLiveKeys.textScriptValue];
// 转换格式
// 先二维转一维
params.type_content = dimensionalConvert(params.type_content);
let list = [];
params.type_content.forEach((item: any) => {
list.push([item]);
});
params.type_content = list;
console.log(params.type_content, '文本 type_content');
// 音色id
params.phonetic_timbres_id = item[createLiveKeys.textSoundColor];
// 文本内容--先转一维数组
......@@ -96,7 +106,6 @@ export const processTextCallback = () => {
});
} else {
// 音频
console.log(item[createLiveKeys.audioScriptList]);
params.type_content = item[createLiveKeys.audioScriptList].map((audioScript: any) => {
let list = [];
audioScript.data.forEach((it: any) => {
......@@ -114,6 +123,13 @@ export const processTextCallback = () => {
});
return list;
});
params.type_content = dimensionalConvert(params.type_content);
let list = [];
params.type_content.forEach((item: any) => {
list.push([item]);
});
params.type_content = list;
console.log(params.type_content, '音频 type_content');
// 音色id
params.phonetic_timbres_id = item[createLiveKeys.phoneticsSoundColor];
}
......@@ -224,9 +240,11 @@ export const processTextCallback = () => {
// 阿里云上传成功回调
const uploadSuccess = (name: string, url: string) => {
alyList.value.push({
alyList.value.push([
{
content: url,
});
},
]);
};
// 循环上传阿里云
......@@ -277,11 +295,12 @@ export const processTextCallback = () => {
if (split_list && split_list.length) {
let result = await uploadToAly(split_list);
console.log('上传完毕');
console.log(result);
// 是否一维数组
if (dimensional) {
console.log(result);
return result;
} else {
console.log([result]);
return [result];
}
}
......@@ -297,7 +316,6 @@ export const processTextCallback = () => {
params.type_content = list;
let res: any = await liveTaskRegenerate(live_task_id.value, params);
if (res.code == 0) {
console.log('提交的参数', params);
console.log(JSON.stringify(params));
console.log('重新生成直播,已经提交-', live_task_id.value);
if (successCallback) {
......@@ -337,18 +355,18 @@ export const processTextCallback = () => {
task_id: getTaskId(isConfuse, uuid),
});
if (res.code == 0) {
// if (isDev()) {
// let params = {
// data: {
// audio_address:
// 'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/ed71050141c74954ac779cfbb9dd9604.wav?Expires=1691136228&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=jE01uOk8Vfa08ovlPbJYI2Bhwvs%3D',
// task_id: 0,
// },
// };
// for (let i = 0; i < 10; i++) {
// res.data.push(params);
// }
// }
if (isDev()) {
let params = {
data: {
audio_address:
'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/e56d8750eb3a44f9930f73703489acb1.wav?Expires=1692087730&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=FtKSld5Dn55po9GyTm%2BefRKmPqw%3D',
task_id: 0,
},
};
for (let i = 0; i < 3; i++) {
res.data.push(params);
}
}
if (res.data.length) {
console.log('音频任务回调成功');
console.log(res.data);
......@@ -385,7 +403,7 @@ export const processTextCallback = () => {
throw new CustomException('没有要处理的音频');
}
let resultList = await audioStart(audio_list, false);
let resultList = await audioStart(audio_list, true);
// 修改store的type_content
commitInfo({
[createLiveKeys.textScriptValue]: resultList,
......@@ -415,9 +433,7 @@ export const processTextCallback = () => {
show_message('洗稿缺少参数');
}
});
let resultList = await audioStart(audio_list, false);
console.log('提交的个数');
console.log(resultList.length);
let resultList = await audioStart(audio_list, true);
// 提交
if (customRegenerate) {
await customRegenerate(resultList);
......
......@@ -55,6 +55,8 @@ const imgs = {
mp3: new URL('../../assets/img/2.wav', import.meta.url).href,
};
const isFirst = ref(true);
// 定时检测python的方法是否注入成功
let interval = null;
......@@ -98,7 +100,6 @@ const mainVideoList = ref([
show: true,
total: 0,
videoIndex: null,
loop: false,
},
{
name: 'mainVideo2',
......@@ -110,7 +111,6 @@ const mainVideoList = ref([
show: false,
total: 0,
videoIndex: null,
loop: false,
},
]);
......@@ -202,29 +202,38 @@ const findOneVideoInit = () => {
let videoTagIndex = mainVideoList.value.findIndex((item: any, index: number) => index !== currentPlayMainIndex.value);
if (videoTagIndex !== -1) {
let hideVideo = mainVideoList.value[videoTagIndex];
// 隐藏的视频已经播放结束
if (!hideVideo.play && hideVideo.playEnd) {
// 隐藏的视频已经播放结束 且 视频列表中不存在有url,没取走的视频
let notRemove = realVideoList.value.find((item: any) => item.result && !item.remove);
if (!hideVideo.play && hideVideo.playEnd && !notRemove) {
console.log('需要重新入队');
status = true;
}
}
// start
if (status) {
// 当前显示的视频
let item = mainVideoList.value[currentPlayMainIndex.value];
// 主视频列表中的行
let videoInfo = realVideoList.value[item.videoIndex];
const changeVideo = (url: string, index: number | boolean = false) => {
hideVideo.play = false;
hideVideo.playEnd = false;
hideVideo.url = url;
if (index !== false) {
hideVideo.videoIndex = index;
}
};
// 找到所有已经播放完毕的主视频
let playEndVideos = realVideoList.value.map((row: any, index: number) => {
let playEndVideos = realVideoList.value.filter((row: any, index: number) => {
if (row.remove && item.result && item.status) {
return index;
}
});
console.log(playEndVideos);
if (playEndVideos.length) {
if (playEndVideos.length === 1) {
console.log('只有一条视频播放完毕,重新播放该视频');
// 循环播放
item.loop = true;
changeVideo(item.url, item.videoIndex);
} else {
// 多条视频
// 随机下标
......@@ -233,19 +242,19 @@ const findOneVideoInit = () => {
// 链接是否一致
if (realVideoList.value[num].result === item.url) {
// 循环播放
item.loop = true;
changeVideo(item.url, item.videoIndex);
console.log('链接一致,等待重新播放');
} else {
// 更新当前视频标签的链接和状态
item.play = false;
item.playEnd = false;
item.videoIndex = num;
item.url = realVideoList.value[num].result;
changeVideo(realVideoList.value[num].result, num);
console.log('成功加入队列');
}
}
} else {
console.log('主视频列表中没有已经播放完毕的视频');
// 将当前正在播放的视频放入video标签
changeVideo(item.url, item.videoIndex);
console.log('将当前视频传给hide的视频');
}
}
}
};
......@@ -275,7 +284,7 @@ const currentTimeChange = (index: number, value: number) => {
// 判断是否需要取之前的主视频
if (currentEsidueTime < 20 && typeof currentPlayMainIndex.value === 'number') {
// findOneVideoInit();
findOneVideoInit();
}
};
......@@ -458,15 +467,18 @@ const getDetail = async (type: string = '') => {
'http://yunyi-tiktok.oss-cn-shenzhen.aliyuncs.com/files/user/admin/9604b4aa-e509-4f74-a73f-a0dc130f8f28.mp4',
'http://yunyi-tiktok.oss-cn-shenzhen.aliyuncs.com/files/user/admin/f2112aea-6f69-4403-acef-33d0fda7e736.mp4',
];
if (realVideoList.value.length > list.length) {
console.log('不需要添加了');
return;
}
// if (realVideoList.value.length > list.length) {
// console.log('不需要添加了');
// return;
// }
if (isFirst.value) {
mergeCallback({
// video: imgs.mp4,
video: list[realVideoList.value.length - 1],
video: list[0],
index: realVideoList.value.length - 1,
});
isFirst.value = false;
}
} else {
// 通知python合并
submitVideo();
......
......@@ -336,6 +336,7 @@ const checkboxChange = (value: boolean) => {
// 新增文本脚本
const addTextScript = () => {
// 打开弹窗
editTextInfo.value = {};
textScriptVisible.value = true;
};
......@@ -374,6 +375,7 @@ const textScriptSubmit = (params: any) => {
// 音频地址
textScriptList.value[params.index].audio_address = '';
} else {
// 创建
textScriptList.value.push(params);
}
submitTextScript();
......
......@@ -85,7 +85,7 @@ import { useLiveInfoSubmit } from '@/hooks/useStoreCommit';
import { processTextCallback } from '@/hooks/useScript';
import CustomException from '@/utils/error';
import { v4 } from 'uuid';
import { splitAudio, splitFile } from '@/utils/audio';
import { splitAudio, audioMerge } from '@/utils/audio';
const {
loading,
initNum,
......@@ -502,23 +502,23 @@ onBeforeMount(() => {
});
// 缓存进入
onActivated(async () => {
onActivated(() => {
enterPageEvent();
// 测试
let list = [
// 小文件
'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/e56d8750eb3a44f9930f73703489acb1.wav?Expires=1692087730&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=FtKSld5Dn55po9GyTm%2BefRKmPqw%3D',
'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/e56d8750eb3a44f9930f73703489acb1.wav?Expires=1692087730&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=FtKSld5Dn55po9GyTm%2BefRKmPqw%3D',
'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/e56d8750eb3a44f9930f73703489acb1.wav?Expires=1692087730&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=FtKSld5Dn55po9GyTm%2BefRKmPqw%3D',
'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/e56d8750eb3a44f9930f73703489acb1.wav?Expires=1692087730&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=FtKSld5Dn55po9GyTm%2BefRKmPqw%3D',
// let list = [
// // 小文件
// 'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/e56d8750eb3a44f9930f73703489acb1.wav?Expires=1692087730&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=FtKSld5Dn55po9GyTm%2BefRKmPqw%3D',
// 'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/e56d8750eb3a44f9930f73703489acb1.wav?Expires=1692087730&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=FtKSld5Dn55po9GyTm%2BefRKmPqw%3D',
// 'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/e56d8750eb3a44f9930f73703489acb1.wav?Expires=1692087730&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=FtKSld5Dn55po9GyTm%2BefRKmPqw%3D',
// 'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/e56d8750eb3a44f9930f73703489acb1.wav?Expires=1692087730&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=FtKSld5Dn55po9GyTm%2BefRKmPqw%3D',
// // 大文件
// // 'http://yunyi-live.oss-cn-hangzhou.aliyuncs.com/upload/15/2023-08-072cfde637-5487-47fc-9cea-3e984b92ee6f.wav',
// ];
// 大文件
// 'http://yunyi-live.oss-cn-hangzhou.aliyuncs.com/upload/15/2023-08-072cfde637-5487-47fc-9cea-3e984b92ee6f.wav',
];
audioStart(list);
// list = await splitFile(list[0], 300);
console.log(list);
// audioStart([
// 'http://nls-cloud-cn-shanghai.oss-cn-shanghai.aliyuncs.com/jupiter-flow/tmp/ad08fa0a70ae4ea88d11ad5e394ce045.wav?Expires=1692149777&OSSAccessKeyId=LTAIUpwNp2H7pBG5&Signature=D93qMT1DovslSOVa9oufV2cGZxE%3D',
// ]);
});
// 路由离开前保存query
......
......@@ -18,7 +18,6 @@ const getBaseUrl = async () => {
try {
const url = await callPyjsInWindow('getDomain', '', true);
if (url) {
console.log('获取到线上地址了', url);
return url;
}
return defaultUrl;
......
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