Commit 251b45e6 by haojie

修改type_content的格式

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