mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 12:15:25 +03:00
Better handle taller video in player
This commit is contained in:
parent
77c061e68c
commit
89093b4190
@ -40,6 +40,19 @@ export default function DynamicVideoPlayer({
|
|||||||
[config]
|
[config]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// playback behavior
|
||||||
|
const tallVideo = useMemo(() => {
|
||||||
|
if (!config) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
config.cameras[camera].detect.width /
|
||||||
|
config.cameras[camera].detect.height <
|
||||||
|
1.7
|
||||||
|
);
|
||||||
|
}, [config]);
|
||||||
|
|
||||||
// controlling playback
|
// controlling playback
|
||||||
|
|
||||||
const playerRef = useRef<Player | undefined>(undefined);
|
const playerRef = useRef<Player | undefined>(undefined);
|
||||||
@ -64,6 +77,7 @@ export default function DynamicVideoPlayer({
|
|||||||
}, [config]);
|
}, [config]);
|
||||||
|
|
||||||
// keyboard control
|
// keyboard control
|
||||||
|
|
||||||
const onKeyboardShortcut = useCallback(
|
const onKeyboardShortcut = useCallback(
|
||||||
(key: string, down: boolean, repeat: boolean) => {
|
(key: string, down: boolean, repeat: boolean) => {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
@ -185,6 +199,8 @@ export default function DynamicVideoPlayer({
|
|||||||
return <ActivityIndicator />;
|
return <ActivityIndicator />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//console.log(`${config.detect.width / config.detect.height < 1.7 ? "16:9" : undefined}`)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
<div
|
<div
|
||||||
@ -197,6 +213,7 @@ export default function DynamicVideoPlayer({
|
|||||||
preload: "auto",
|
preload: "auto",
|
||||||
autoplay: true,
|
autoplay: true,
|
||||||
sources: [initialPlaybackSource],
|
sources: [initialPlaybackSource],
|
||||||
|
aspectRatio: tallVideo ? "16:9" : undefined,
|
||||||
controlBar: {
|
controlBar: {
|
||||||
remainingTimeDisplay: false,
|
remainingTimeDisplay: false,
|
||||||
progressControl: {
|
progressControl: {
|
||||||
@ -239,6 +256,7 @@ export default function DynamicVideoPlayer({
|
|||||||
muted: true,
|
muted: true,
|
||||||
loadingSpinner: false,
|
loadingSpinner: false,
|
||||||
sources: hasPreview ? initialPreviewSource : null,
|
sources: hasPreview ? initialPreviewSource : null,
|
||||||
|
aspectRatio: tallVideo ? "16:9" : undefined,
|
||||||
}}
|
}}
|
||||||
seekOptions={{}}
|
seekOptions={{}}
|
||||||
onReady={(player) => {
|
onReady={(player) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user