Commit 096e7203 by haojie

增加新版直播页面

parent ba2ce170
......@@ -52,6 +52,8 @@ import { onBeforeRouteLeave } from 'vue-router';
import { injectWindow } from '@/utils/pyqt';
import { scriptTypePhonetics } from '@/service/CreateLive';
// 再加一个动作视频标签
const props = withDefaults(
defineProps<{
playMainIndex: number | null;
......
......@@ -71,7 +71,7 @@ export const getRoutes = () => {
{
path: routerConfig.onlyVideoLive.path,
name: routerConfig.onlyVideoLive.name,
component: () => import('@/pages/OnlyVideoLive/index.vue'),
component: () => import('@/pages/OnlyVideoLive/indexV2.vue'),
meta: { title: 'snowhome', header: false, navbar: false },
},
// 只有人工回复的页面
......
......@@ -55,6 +55,8 @@ const imgs = {
mp4: new URL('../../assets/img/1.mp4', import.meta.url).href,
};
// 本次测试用的变量
const requestNum = ref(0);
const isFirst = ref(true);
// 定时检测python的方法是否注入成功
......@@ -434,19 +436,46 @@ const getDetail = async (type: string = '') => {
if (isDev()) {
// 创建url
res.data = {};
res.data.url = [
'http://yunyi-live.oss-cn-hangzhou.aliyuncs.com/live/output/87.mp4',
'http://yunyi-live.oss-cn-hangzhou.aliyuncs.com/live/output/87.mp4',
'http://yunyi-live.oss-cn-hangzhou.aliyuncs.com/live/output/87.mp4',
let list = [
{
url: 'http://yunyi-tiktok.oss-cn-shenzhen.aliyuncs.com/files/user/admin/e9f3d546-05f2-4dc1-a37d-d6c0ca960e43.mp4',
type: 1,
},
{
url: 'http://yunyi-tiktok.oss-cn-shenzhen.aliyuncs.com/files/user/admin/9604b4aa-e509-4f74-a73f-a0dc130f8f28.mp4',
type: 3,
// 是否需要播放
},
{
url: 'http://yunyi-tiktok.oss-cn-shenzhen.aliyuncs.com/files/user/admin/f2112aea-6f69-4403-acef-33d0fda7e736.mp4',
type: 1,
},
];
res.data.type_content = [
// 哪些时间段不能播放动作视频和互动视频
res.data.period = [
{
content: '测试文案提交',
start: 1,
end: 5,
},
{
start: 12,
end: 30,
},
];
res.data.url = list;
}
if (DataType(res.data, 'object') && res.data.url && res.data.url.length) {
//
// 初始化视频列表的状态
res.data.url.forEach((item: any) => {
// 是否播放完毕
item.status = false;
// 是否取走
item.remove = false;
// 是否正在播放
item.play = false;
});
// 取出所有 type==1 的主视频,计算总时长
realVideoList.value.push({
url: res.data.url,
// 合并后的地址
......@@ -459,27 +488,16 @@ const getDetail = async (type: string = '') => {
play: false,
// 是否已经提交给python
submit: false,
// 下一个视频的状态
// 下一个视频的状态(洗稿状态)
confuse: CONFUSE_STATUS.CONFUSE_STATUS_WAIT,
// 洗稿任务的uuid
uuid: v4(),
});
if (isDev()) {
let list = [
'http://yunyi-tiktok.oss-cn-shenzhen.aliyuncs.com/files/user/admin/e9f3d546-05f2-4dc1-a37d-d6c0ca960e43.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',
];
// if (realVideoList.value.length > list.length) {
// console.log('不需要添加了');
// return;
// }
if (isFirst.value) {
mergeCallback({
// video: imgs.mp4,
video: list[0],
video: res.data.url[0].url,
index: realVideoList.value.length - 1,
childIndex: 0,
});
isFirst.value = false;
}
......
......@@ -4,6 +4,7 @@ import { audioStart } from '@/service/Common';
import store from '@/store';
import { v4 } from 'uuid';
import { writeLog } from '@/utils/pyqt';
import { getDurationOfAudioFile } from '@/utils/audio';
/**
* 创建直播的版本
......@@ -56,6 +57,45 @@ export const typeSoundColor = 2; // 音色
export const movementTypeStart = 1; // 开头插入
export const movementTypeEnd = 2; // 结尾插入
// 计算音频块列表的开始时间和结束时间
export const getAudioStartTimeAndEndTime = async (list: any[]) => {
try {
let durationList = [];
for (let i = 0; i < list.length; i++) {
let data = list[i].data;
let params: any = {
audio_url: data.audio_address,
};
// 计算音频块的起始与结束时间点
let duration = await getDurationOfAudioFile(data.audio_address);
console.log(duration);
params.duration = duration;
// 默认值
params.start = 0;
params.end = duration;
durationList.forEach((it: any) => {
// 开始时间
params.start += it.duration;
});
durationList.push(params);
if (i !== 0) {
durationList.forEach((it: any, index: number) => {
// 不包括自己
if (index !== durationList.length - 1) {
// 结束时间
durationList[i].end += it.duration;
}
});
}
}
return durationList;
} catch (e) {
console.log(e);
}
};
// 合并同类项音频
export const mergeSameAudio = (content: any[]) => {
let list = [];
......
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