mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 01:35:22 +03:00
Adjust VideoPlayer to accept live option which disables irrelevant controls
This commit is contained in:
parent
2096701c79
commit
a6867bf89b
@ -6,7 +6,7 @@ import 'videojs-seek-buttons';
|
|||||||
import 'video.js/dist/video-js.css';
|
import 'video.js/dist/video-js.css';
|
||||||
import 'videojs-seek-buttons/dist/videojs-seek-buttons.css';
|
import 'videojs-seek-buttons/dist/videojs-seek-buttons.css';
|
||||||
|
|
||||||
export default function VideoPlayer({ children, options, seekOptions = {}, onReady = () => {}, onDispose = () => {} }) {
|
export default function VideoPlayer({ children, options, audio=true, live=false, seekOptions = {}, onReady = () => {}, onDispose = () => {} }) {
|
||||||
const playerRef = useRef();
|
const playerRef = useRef();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -25,7 +25,7 @@ export default function VideoPlayer({ children, options, seekOptions = {}, onRea
|
|||||||
defaultOptions.playbackRates.push(16);
|
defaultOptions.playbackRates.push(16);
|
||||||
}
|
}
|
||||||
|
|
||||||
const player = videojs(playerRef.current, { ...defaultOptions, ...options }, () => {
|
const player = videojs(playerRef.current, { ...defaultOptions, ...options, controlBar: { volumePanel: audio, playToggle: !live, progressControl: !live, remainingTimeDisplay: !live, playbackRateMenuButton: !live } }, () => {
|
||||||
onReady(player);
|
onReady(player);
|
||||||
});
|
});
|
||||||
player.seekButtons({
|
player.seekButtons({
|
||||||
|
|||||||
@ -94,11 +94,13 @@ export default function Camera({ camera }) {
|
|||||||
|
|
||||||
let player;
|
let player;
|
||||||
if (viewMode === 'live') {
|
if (viewMode === 'live') {
|
||||||
if (cameraConfig.live.source == 'restream') {
|
if (cameraConfig.live.source == 'mp4') {
|
||||||
player = (
|
player = (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div style={`max-height: ${cameraConfig.live.height}px; max-width: ${liveWidth}px`}>
|
<div style={`max-height: ${cameraConfig.live.height}px; max-width: ${liveWidth}px`}>
|
||||||
<VideoPlayer
|
<VideoPlayer
|
||||||
|
audio={false}
|
||||||
|
live={true}
|
||||||
options={{
|
options={{
|
||||||
autoplay: true,
|
autoplay: true,
|
||||||
preload: 'metadata',
|
preload: 'metadata',
|
||||||
@ -111,6 +113,7 @@ export default function Camera({ camera }) {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
|
seekOptions={{ forward: false, back: false }}
|
||||||
onReady={() => {}}
|
onReady={() => {}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user