diff --git a/src/app/[locale]/PageComponent.tsx b/src/app/[locale]/PageComponent.tsx
index 1ec099f..d9d13cf 100644
--- a/src/app/[locale]/PageComponent.tsx
+++ b/src/app/[locale]/PageComponent.tsx
@@ -34,7 +34,7 @@ const PageComponent = ({
const handleSubmit = async (e: { preventDefault: () => void }) => {
e.preventDefault();
if (!textStr) {
- setVideoList(randomVideo());
+ setVideoList(randomVideo(3));
return;
}
setShowLoadingModal(true);
@@ -167,6 +167,7 @@ const PageComponent = ({
controls={true}
autoPlay={true}
src={video.url}
+ preload={"metadata"}
>
@@ -196,6 +197,7 @@ const PageComponent = ({
controls={true}
autoPlay={false}
src={item.url}
+ preload={"metadata"}
>
@@ -230,6 +232,7 @@ const PageComponent = ({
autoPlay={false}
controlsList={"nodownload"}
src={item.videoUrl}
+ preload={"metadata"}
>
diff --git a/src/app/[locale]/page.tsx b/src/app/[locale]/page.tsx
index 343741b..9830914 100644
--- a/src/app/[locale]/page.tsx
+++ b/src/app/[locale]/page.tsx
@@ -21,7 +21,7 @@ export default async function IndexPage({params: {locale = ''}}) {
prompt: t('prompt'),
};
- const initVideoList = randomVideo();
+ const initVideoList = randomVideo(3);
return (
diff --git a/src/data/openaiVideo.ts b/src/data/openaiVideo.ts
index 49b9abd..a620185 100644
--- a/src/data/openaiVideo.ts
+++ b/src/data/openaiVideo.ts
@@ -290,12 +290,12 @@ export const allVideoList = [
]
-export const randomVideo = () => {
+export const randomVideo = (count:number) => {
// 定义一个空数组来存放随机数
let randomNumbers = [];
const resultVideoList = [];
// 循环获取多个不同的随机数
- while (randomNumbers.length < 5) {
+ while (randomNumbers.length < count) {
let randomNumber = Math.floor(Math.random() * (allVideoList.length + 1));
if (!randomNumbers.includes(randomNumber)) {
randomNumbers.push(randomNumber);