mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-03 06:50:58 +00:00
Compare commits
2 Commits
d27e8c1bbf
...
95cea06dd3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95cea06dd3 | ||
|
|
ec2543c23f |
@ -1,4 +1,10 @@
|
||||
import React, { useState, useRef, useEffect, useCallback } from "react";
|
||||
import React, {
|
||||
useState,
|
||||
useRef,
|
||||
useEffect,
|
||||
useCallback,
|
||||
useMemo,
|
||||
} from "react";
|
||||
import { useVideoDimensions } from "@/hooks/use-video-dimensions";
|
||||
import HlsVideoPlayer from "./HlsVideoPlayer";
|
||||
import ActivityIndicator from "../indicators/activity-indicator";
|
||||
@ -89,6 +95,12 @@ export function GenericVideoPlayer({
|
||||
},
|
||||
);
|
||||
|
||||
const hlsSource = useMemo(() => {
|
||||
return {
|
||||
playlist: source,
|
||||
};
|
||||
}, [source]);
|
||||
|
||||
return (
|
||||
<div ref={containerRef} className="relative flex h-full w-full flex-col">
|
||||
<div className="relative flex flex-grow items-center justify-center">
|
||||
@ -107,9 +119,7 @@ export function GenericVideoPlayer({
|
||||
>
|
||||
<HlsVideoPlayer
|
||||
videoRef={videoRef}
|
||||
currentSource={{
|
||||
playlist: source,
|
||||
}}
|
||||
currentSource={hlsSource}
|
||||
hotKeys
|
||||
visible
|
||||
frigateControls={false}
|
||||
|
||||
@ -17,7 +17,7 @@ export function useVideoDimensions(
|
||||
});
|
||||
|
||||
const videoAspectRatio = useMemo(() => {
|
||||
return videoResolution.width / videoResolution.height;
|
||||
return videoResolution.width / videoResolution.height || 16 / 9;
|
||||
}, [videoResolution]);
|
||||
|
||||
const containerAspectRatio = useMemo(() => {
|
||||
@ -25,7 +25,7 @@ export function useVideoDimensions(
|
||||
}, [containerWidth, containerHeight]);
|
||||
|
||||
const videoDimensions = useMemo(() => {
|
||||
if (!containerWidth || !containerHeight || !videoAspectRatio)
|
||||
if (!containerWidth || !containerHeight)
|
||||
return { width: "100%", height: "100%" };
|
||||
if (containerAspectRatio > videoAspectRatio) {
|
||||
const height = containerHeight;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user