dev-v2
Joe 4 months ago
parent 6010109462
commit d68fa31ed5

@ -117,6 +117,7 @@ const AliVideoUpload: React.FC<AliVideoUploadProps> = ({
// 文件上传成功
onUploadSucceed: (uploadInfo: any) => {
console.log('上传成功:', uploadInfo);
setTimeout(() => {
getVideoAuthByVideoIdUsingGet({ id: uploadInfo.videoId }).then(res => {
if (res.retcode) {
resolve({
@ -132,6 +133,7 @@ const AliVideoUpload: React.FC<AliVideoUploadProps> = ({
message.error(error);
reject(new Error(error));
})
}, 1000);
},
// 文件上传失败
onUploadFailed: (uploadInfo: any, code: string, message: string) => {

@ -23,6 +23,7 @@ import { addOrUpdateChapterUsingPost, removeChapterUsingGet } from '@/services/p
import { addOrUpdateVideoUsingPost, getVideoAuthByIdUsingGet, removeVideoUsingGet } from '@/services/pop-b2b2c/pbcTrainingClassesVideoController';
import AliPlayer from '@/components/AliPlayer';
import AliVideoUpload from '@/components/AliVideoUpload';
import { getVideoAuthByVideoIdUsingGet } from '@/services/pop-b2b2c/pbcVodController';
/**
*
@ -274,6 +275,14 @@ const Detail: React.FC<any> = () => {
);
};
const getVideoDuration = async (videoId: string) => {
const res = await getVideoAuthByVideoIdUsingGet({ id: videoId })
if (res.retcode) {
return res.data?.videoMeta?.duration ? res.data?.videoMeta?.duration.toString() : ''
}
return ''
}
return (
<PageContainer
header={{
@ -518,6 +527,9 @@ const Detail: React.FC<any> = () => {
if (value.pbcVideoAddress[0].uid === '-1') {
pbcVideoAddress = value.pbcVideoAddress[0].url || '';
pbcVideoDuration = stepFormValues1.pbcVideoDuration || ''
if (!stepFormValues1.pbcVideoDuration) {
pbcVideoDuration = await getVideoDuration(value.pbcVideoAddress[0].url)
}
}
if (
value.pbcVideoAddress[0].response &&
@ -526,7 +538,10 @@ const Detail: React.FC<any> = () => {
if (fileType === '1') {
// 客户端上传的视频数据
pbcVideoAddress = value.pbcVideoAddress[0].response.data.videoId;
pbcVideoDuration = value.pbcVideoAddress[0].response.data.duration || '';
pbcVideoDuration = value.pbcVideoAddress[0].response.data.duration;
if (!value.pbcVideoAddress[0].response.data.duration) {
pbcVideoDuration = await getVideoDuration(value.pbcVideoAddress[0].response.data.videoId)
}
} else {
// 服务端上传的文件数据
pbcVideoAddress = value.pbcVideoAddress[0].response.data;

Loading…
Cancel
Save