diff --git a/web/Dockerfile b/web/Dockerfile index d7ff8a4..979740d 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,5 +1,18 @@ +FROM node:16-alpine AS build + +WORKDIR /web + +COPY package.json ./ + +RUN yarn install + +COPY . . + +RUN yarn build + FROM nginx:stable-alpine -COPY /build /usr/share/nginx/html + +COPY --from=build /web/build /usr/share/nginx/html RUN sed -i '12a error_page 404 /index.html;' /etc/nginx/conf.d/default.conf @@ -8,4 +21,5 @@ RUN sed -i '/^http {/a \ gzip_static on;' /etc/nginx/nginx.conf EXPOSE 80 + CMD ["nginx", "-g", "daemon off;"] diff --git a/web/src/pages/components/video-playback/index.tsx b/web/src/pages/components/video-playback/index.tsx index a75ca58..b3a78fa 100644 --- a/web/src/pages/components/video-playback/index.tsx +++ b/web/src/pages/components/video-playback/index.tsx @@ -425,13 +425,13 @@ export const VideoPlayback = (props: {
{item.timeList.map((item, i) => { - const startTime = dayjs(warningDetails.startTime).utc(); + const startTime = dayjs(warningDetails.startTime); const endTime = startTime .add(Number(warningDetails.duration ?? 0), "second") .add(5, "minute"); - return endTime < dayjs(item[0]).utc() ? ( + return endTime < dayjs(item[0]) ? (
) : (
@@ -458,15 +458,13 @@ export const VideoPlayback = (props: { className={`w-1/5 h-max relative`} >
- {index === 0 || index === 4 + {index / 4 === 0 ? dayjs(time).format("hh:mm A") : ""}
); - return endTimeIndex ? ( - index <= endTimeIndex ? ( + return endTimeIndex >= 0 ? ( + index <= endTimeIndex + 2 ? ( node ) : (
{ // 回調獲取導出視頻url const handelGetVideoPlayBackData = (id: string) => { + let playbackTimer: NodeJS.Timeout | null = null; + if (isPlayBackCallBackData) return; id && @@ -104,12 +106,12 @@ export const useAction = () => { handelDownloadUrl(generateUrl); setIsPlayBackCallBackData(true); - return; + playbackTimer && clearTimeout(playbackTimer); } }) .catch(() => {}); - setTimeout(() => { + playbackTimer = setTimeout(() => { handelGetVideoPlayBackData(id); }, 5000); };