mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-18 17:14:26 +03:00
optional stats to fix birdseye player
This commit is contained in:
parent
0a9bf413f6
commit
14acca3a01
@ -14,7 +14,7 @@ type JSMpegPlayerProps = {
|
|||||||
containerRef: React.MutableRefObject<HTMLDivElement | null>;
|
containerRef: React.MutableRefObject<HTMLDivElement | null>;
|
||||||
playbackEnabled: boolean;
|
playbackEnabled: boolean;
|
||||||
useWebGL: boolean;
|
useWebGL: boolean;
|
||||||
setStats: (stats: PlayerStatsType) => void;
|
setStats?: (stats: PlayerStatsType) => void;
|
||||||
onPlaying?: () => void;
|
onPlaying?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ export default function JSMpegPlayer({
|
|||||||
const timeDiff = (currentTimestamp - lastTimestampRef.current) / 1000; // in seconds
|
const timeDiff = (currentTimestamp - lastTimestampRef.current) / 1000; // in seconds
|
||||||
const bitrate = (bytesReceivedRef.current * 8) / timeDiff / 1000; // in kbps
|
const bitrate = (bytesReceivedRef.current * 8) / timeDiff / 1000; // in kbps
|
||||||
|
|
||||||
setStats({
|
setStats?.({
|
||||||
streamType: "jsmpeg",
|
streamType: "jsmpeg",
|
||||||
bandwidth: Math.round(bitrate),
|
bandwidth: Math.round(bitrate),
|
||||||
totalFrames: frameCount,
|
totalFrames: frameCount,
|
||||||
|
|||||||
@ -22,8 +22,8 @@ type MSEPlayerProps = {
|
|||||||
volume?: number;
|
volume?: number;
|
||||||
playInBackground?: boolean;
|
playInBackground?: boolean;
|
||||||
pip?: boolean;
|
pip?: boolean;
|
||||||
getStats: boolean;
|
getStats?: boolean;
|
||||||
setStats: (stats: PlayerStatsType) => void;
|
setStats?: (stats: PlayerStatsType) => void;
|
||||||
onPlaying?: () => void;
|
onPlaying?: () => void;
|
||||||
setFullResolution?: React.Dispatch<SetStateAction<VideoResolutionType>>;
|
setFullResolution?: React.Dispatch<SetStateAction<VideoResolutionType>>;
|
||||||
onError?: (error: LivePlayerError) => void;
|
onError?: (error: LivePlayerError) => void;
|
||||||
@ -37,7 +37,7 @@ function MSEPlayer({
|
|||||||
volume,
|
volume,
|
||||||
playInBackground = false,
|
playInBackground = false,
|
||||||
pip = false,
|
pip = false,
|
||||||
getStats,
|
getStats = false,
|
||||||
setStats,
|
setStats,
|
||||||
onPlaying,
|
onPlaying,
|
||||||
setFullResolution,
|
setFullResolution,
|
||||||
@ -611,7 +611,7 @@ function MSEPlayer({
|
|||||||
? (droppedVideoFrames / totalVideoFrames) * 100
|
? (droppedVideoFrames / totalVideoFrames) * 100
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
setStats({
|
setStats?.({
|
||||||
streamType: "MSE",
|
streamType: "MSE",
|
||||||
bandwidth,
|
bandwidth,
|
||||||
latency,
|
latency,
|
||||||
@ -627,7 +627,7 @@ function MSEPlayer({
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
setStats({
|
setStats?.({
|
||||||
streamType: "-",
|
streamType: "-",
|
||||||
bandwidth: 0,
|
bandwidth: 0,
|
||||||
latency: undefined,
|
latency: undefined,
|
||||||
|
|||||||
@ -11,8 +11,8 @@ type WebRtcPlayerProps = {
|
|||||||
microphoneEnabled?: boolean;
|
microphoneEnabled?: boolean;
|
||||||
iOSCompatFullScreen?: boolean; // ios doesn't support fullscreen divs so we must support the video element
|
iOSCompatFullScreen?: boolean; // ios doesn't support fullscreen divs so we must support the video element
|
||||||
pip?: boolean;
|
pip?: boolean;
|
||||||
getStats: boolean;
|
getStats?: boolean;
|
||||||
setStats: (stats: PlayerStatsType) => void;
|
setStats?: (stats: PlayerStatsType) => void;
|
||||||
onPlaying?: () => void;
|
onPlaying?: () => void;
|
||||||
onError?: (error: LivePlayerError) => void;
|
onError?: (error: LivePlayerError) => void;
|
||||||
};
|
};
|
||||||
@ -26,7 +26,7 @@ export default function WebRtcPlayer({
|
|||||||
microphoneEnabled = false,
|
microphoneEnabled = false,
|
||||||
iOSCompatFullScreen = false,
|
iOSCompatFullScreen = false,
|
||||||
pip = false,
|
pip = false,
|
||||||
getStats,
|
getStats = false,
|
||||||
setStats,
|
setStats,
|
||||||
onPlaying,
|
onPlaying,
|
||||||
onError,
|
onError,
|
||||||
@ -268,7 +268,7 @@ export default function WebRtcPlayer({
|
|||||||
? (bytesReceived - lastBytesReceived) / timeDiff / 1000
|
? (bytesReceived - lastBytesReceived) / timeDiff / 1000
|
||||||
: 0; // in kbps
|
: 0; // in kbps
|
||||||
|
|
||||||
setStats({
|
setStats?.({
|
||||||
streamType: "WebRTC",
|
streamType: "WebRTC",
|
||||||
bandwidth: Math.round(bitrate),
|
bandwidth: Math.round(bitrate),
|
||||||
latency: roundTripTime,
|
latency: roundTripTime,
|
||||||
@ -286,7 +286,7 @@ export default function WebRtcPlayer({
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
setStats({
|
setStats?.({
|
||||||
streamType: "-",
|
streamType: "-",
|
||||||
bandwidth: 0,
|
bandwidth: 0,
|
||||||
latency: undefined,
|
latency: undefined,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user