forked from 77media/video-flow
更新 水印传参
This commit is contained in:
parent
928c666305
commit
392f29c7b6
@ -281,7 +281,7 @@ export default function CreateToVideo2() {
|
||||
try {
|
||||
const json: any = await post('/movie/download_video', {
|
||||
project_id: project.project_id,
|
||||
watermark: !withWatermark
|
||||
watermark: withWatermark
|
||||
});
|
||||
const url = json?.data?.download_url as string | undefined;
|
||||
if (url) {
|
||||
|
||||
@ -484,7 +484,7 @@ export function H5MediaViewer({
|
||||
const json: any = await post('/movie/download_video', {
|
||||
project_id: episodeId,
|
||||
video_id: current.video_id,
|
||||
watermark: !withWatermark
|
||||
watermark: withWatermark
|
||||
});
|
||||
const url = json?.data?.download_url as string | undefined;
|
||||
if (url) await downloadVideo(url);
|
||||
@ -531,7 +531,7 @@ export function H5MediaViewer({
|
||||
onDownloadCurrent: async (withWatermark: boolean) => {
|
||||
const json: any = await post('/movie/download_video', {
|
||||
project_id: episodeId,
|
||||
watermark: !withWatermark
|
||||
watermark: withWatermark
|
||||
});
|
||||
const url = json?.data?.download_url as string | undefined;
|
||||
if (url) await downloadVideo(url);
|
||||
|
||||
@ -4,7 +4,7 @@ import React, { useEffect, useRef, useState } from 'react';
|
||||
import { Checkbox } from 'antd';
|
||||
import { createRoot, Root } from 'react-dom/client';
|
||||
import { X, Download, ArrowDownWideNarrow } from 'lucide-react';
|
||||
import { baseUrl } from '@/lib/env';
|
||||
import { post } from '@/api/request';
|
||||
|
||||
interface DownloadOptionsModalProps {
|
||||
onDownloadCurrent: (withWatermark: boolean) => void;
|
||||
@ -45,29 +45,12 @@ function DownloadOptionsModal(props: DownloadOptionsModalProps) {
|
||||
let aborted = false;
|
||||
const checkBalance = async () => {
|
||||
try {
|
||||
if (!projectId) {
|
||||
setBaseAmount(0);
|
||||
return;
|
||||
}
|
||||
const token = typeof window !== 'undefined' ? (localStorage?.getItem('token') || '') : '';
|
||||
const res = await fetch(`${baseUrl}/movie/download_video`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...(token ? { 'Authorization': `Bearer ${token}` } : {})
|
||||
},
|
||||
body: JSON.stringify({
|
||||
project_id: projectId,
|
||||
video_id: videoId,
|
||||
watermark: !withWatermark,
|
||||
check_balance: true
|
||||
})
|
||||
const json: any = await post('/movie/download_video', {
|
||||
project_id: projectId,
|
||||
video_id: videoId,
|
||||
watermark: withWatermark,
|
||||
check_balance: true
|
||||
});
|
||||
if (!res.ok) {
|
||||
if (!aborted) setBaseAmount(0);
|
||||
return;
|
||||
}
|
||||
const json = await res.json().catch(() => null);
|
||||
const amount = json?.data?.base_amount;
|
||||
if (!aborted) setBaseAmount(Number.isFinite(amount) ? Number(amount) : 0);
|
||||
} catch {
|
||||
@ -116,7 +99,7 @@ function DownloadOptionsModal(props: DownloadOptionsModalProps) {
|
||||
Choose your download preference
|
||||
</p>
|
||||
<div data-alt="price-indicator" className="mt-2 text-center text-sm font-medium">
|
||||
{baseAmount && baseAmount !== 0 ? (
|
||||
{!withWatermark && baseAmount && baseAmount !== 0 ? (
|
||||
<span className="text-red-400">-{baseAmount} credits</span>
|
||||
) : (
|
||||
<span className="text-green-400">free</span>
|
||||
|
||||
@ -17,6 +17,7 @@ import { post } from '@/api/request';
|
||||
import { VideoEditOverlay } from './video-edit/VideoEditOverlay';
|
||||
import { EditPoint as EditPointType } from './video-edit/types';
|
||||
import { isVideoModificationEnabled } from '@/lib/server-config';
|
||||
import { useSearchParams } from 'next/navigation';
|
||||
import error_image from '@/public/assets/error.webp';
|
||||
import { AspectRatioValue } from '@/components/ChatInputBox/AspectRatioSelector';
|
||||
|
||||
@ -91,7 +92,8 @@ export const MediaViewer = React.memo(function MediaViewer({
|
||||
const [isVideoEditMode, setIsVideoEditMode] = useState(false);
|
||||
// 控制钢笔图标显示的状态 - 参考谷歌登录按钮的实现
|
||||
const [showVideoModification, setShowVideoModification] = useState(false);
|
||||
|
||||
const searchParams = useSearchParams();
|
||||
const episodeId = searchParams.get('episodeId') || '';
|
||||
useEffect(() => {
|
||||
if (isSmartChatBoxOpen) {
|
||||
const videoContentWidth = videoContentRef.current?.clientWidth ?? 0;
|
||||
@ -519,13 +521,13 @@ export const MediaViewer = React.memo(function MediaViewer({
|
||||
totalVideos: totalVideos + 1,
|
||||
isCurrentVideoFailed: false,
|
||||
isFinalStage: true,
|
||||
projectId: projectId || '',
|
||||
projectId: episodeId || '',
|
||||
onDownloadCurrent: async (withWatermark: boolean) => {
|
||||
setIsLoadingDownloadBtn(true);
|
||||
try {
|
||||
const json: any = await post('/movie/download_video', {
|
||||
project_id: projectId || '',
|
||||
watermark: !withWatermark
|
||||
project_id: episodeId,
|
||||
watermark: withWatermark
|
||||
});
|
||||
const url = json?.data?.download_url as string | undefined;
|
||||
if (url) await downloadVideo(url);
|
||||
@ -679,16 +681,16 @@ export const MediaViewer = React.memo(function MediaViewer({
|
||||
totalVideos: taskObject.final.url ? totalVideos + 1 : totalVideos,
|
||||
isCurrentVideoFailed: isCurrentVideoFailed,
|
||||
isFinalStage: false,
|
||||
projectId: projectId || '',
|
||||
projectId: episodeId,
|
||||
videoId: currentVideo?.video_id,
|
||||
onDownloadCurrent: async (withWatermark: boolean) => {
|
||||
if (!currentVideo?.video_id) return;
|
||||
setIsLoadingDownloadBtn(true);
|
||||
try {
|
||||
const json: any = await post('/movie/download_video', {
|
||||
project_id: projectId || '',
|
||||
project_id: episodeId,
|
||||
video_id: currentVideo.video_id,
|
||||
watermark: !withWatermark
|
||||
watermark: withWatermark
|
||||
});
|
||||
const url = json?.data?.download_url as string | undefined;
|
||||
if (url) await downloadVideo(url);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user