|
@@ -1,9 +1,9 @@
|
|
|
-import { useState, useEffect } from "react";
|
|
|
-import { useParams } from "react-router-dom";
|
|
|
-import PlyrPlayer from "../components/public/PlyrPlayer";
|
|
|
-import VidStackPlayer from "../components/public/VidStackPlayer";
|
|
|
-import { useTranslation } from "react-i18next";
|
|
|
-import FPlatformEnum from "../utils/enum";
|
|
|
+import { useState, useEffect } from 'react';
|
|
|
+import { useParams } from 'react-router-dom';
|
|
|
+import PlyrPlayer from '../components/public/PlyrPlayer';
|
|
|
+import VidStackPlayer from '../components/public/VidStackPlayer';
|
|
|
+import { useTranslation } from 'react-i18next';
|
|
|
+import FPlatformEnum from '../utils/enum';
|
|
|
|
|
|
export default function VideoPlayer() {
|
|
|
// 解码 base64 化的视频 url:
|
|
@@ -18,12 +18,12 @@ export default function VideoPlayer() {
|
|
|
|
|
|
const [plyrProps, setPlyrProps] = useState({
|
|
|
source: {
|
|
|
- type: "video",
|
|
|
- title: "Video",
|
|
|
+ type: 'video',
|
|
|
+ title: 'Video',
|
|
|
sources: [
|
|
|
{
|
|
|
src: decodeFileUrl(fileUrl),
|
|
|
- type: "video/mp4",
|
|
|
+ type: 'video/mp4',
|
|
|
size: 720,
|
|
|
},
|
|
|
],
|
|
@@ -40,12 +40,12 @@ export default function VideoPlayer() {
|
|
|
useEffect(() => {
|
|
|
setPlyrProps({
|
|
|
source: {
|
|
|
- type: "video",
|
|
|
- title: "Video",
|
|
|
+ type: 'video',
|
|
|
+ title: 'Video',
|
|
|
sources: [
|
|
|
{
|
|
|
src: decodeFileUrl(fileUrl),
|
|
|
- type: "video/mp4",
|
|
|
+ type: 'video/mp4',
|
|
|
size: 720,
|
|
|
},
|
|
|
],
|
|
@@ -57,17 +57,17 @@ export default function VideoPlayer() {
|
|
|
autoplay: true,
|
|
|
hideControls: false,
|
|
|
controls: [
|
|
|
- "play",
|
|
|
- "progress",
|
|
|
- "current-time",
|
|
|
- FPlatformEnum.byIndex(platform).isWeb() ? "duration" : "", // 移动端屏幕小,不显示视频总时长
|
|
|
- "mute",
|
|
|
- "settings",
|
|
|
- "fullscreen",
|
|
|
+ 'play',
|
|
|
+ 'progress',
|
|
|
+ 'current-time',
|
|
|
+ FPlatformEnum.byIndex(platform).isWeb() ? 'duration' : '', // 移动端屏幕小,不显示视频总时长
|
|
|
+ 'mute',
|
|
|
+ 'settings',
|
|
|
+ 'fullscreen',
|
|
|
],
|
|
|
i18n: {
|
|
|
- speed: t("播放速度"),
|
|
|
- normal: t("正常"),
|
|
|
+ speed: t('播放速度'),
|
|
|
+ normal: t('正常'),
|
|
|
},
|
|
|
speed: {
|
|
|
selected: 1,
|
|
@@ -84,23 +84,23 @@ export default function VideoPlayer() {
|
|
|
});
|
|
|
}, [fileUrl, platform, t]);
|
|
|
|
|
|
- // return (
|
|
|
- // <div className="m-0 flex h-screen w-screen items-center justify-center p-0">
|
|
|
- // <div className="mx-auto w-full max-w-5xl">
|
|
|
- // <VidStackPlayer plyrProps={plyrProps} />
|
|
|
- // </div>
|
|
|
- // </div>
|
|
|
- // );
|
|
|
return (
|
|
|
- <div>
|
|
|
- <div
|
|
|
- className={
|
|
|
- FPlatformEnum.byIndex(platform).isWeb()
|
|
|
- ? 'plyr-wrapper-16-9'
|
|
|
- : 'plyr-wrapper-1-1'
|
|
|
- }>
|
|
|
- <PlyrPlayer plyrProps={plyrProps} />
|
|
|
+ <div className='m-0 flex h-screen w-screen items-center justify-center p-0'>
|
|
|
+ <div className='mx-auto w-full max-w-5xl'>
|
|
|
+ <VidStackPlayer plyrProps={plyrProps} />
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
|
+ // return (
|
|
|
+ // <div>
|
|
|
+ // <div
|
|
|
+ // className={
|
|
|
+ // FPlatformEnum.byIndex(platform).isWeb()
|
|
|
+ // ? 'plyr-wrapper-16-9'
|
|
|
+ // : 'plyr-wrapper-1-1'
|
|
|
+ // }>
|
|
|
+ // <PlyrPlayer plyrProps={plyrProps} />
|
|
|
+ // </div>
|
|
|
+ // </div>
|
|
|
+ // );
|
|
|
}
|