Add support for go2rtc for non-Frigate cameras
This commit is contained in:
1 parent
db50e36c76
commit
b43389ed5b
14 files changed
+409
-62
No files matched your search
@@ -3,10 +3,11 @@ import {
|
||||
capEndDate,
|
||||
convertRangeToCacheFriendlyTimes,
|
||||
getCameraEntityFromConfig,
|
||||
getDefaultGo2RTCEndpoint,
|
||||
sortMedia,
|
||||
} from '../../src/camera-manager/util.js';
|
||||
} from '../../src/camera-manager/utils.js';
|
||||
import { CameraConfig, cameraConfigSchema } from '../../src/config/types.js';
|
||||
import { TestViewMedia } from '../test-utils.js';
|
||||
import { TestViewMedia, createCameraConfig } from '../test-utils.js';
|
||||
|
||||
describe('convertRangeToCacheFriendlyTimes', () => {
|
||||
it('should return cache friendly within hour range', () => {
|
||||
@@ -134,3 +135,41 @@ describe('getCameraEntityFromConfig', () => {
|
||||
expect(getCameraEntityFromConfig(createCameraConfig({}))).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getDefaultGo2RTCEndpoint', () => {
|
||||
it('with local configuration', () => {
|
||||
expect(
|
||||
getDefaultGo2RTCEndpoint(
|
||||
createCameraConfig({
|
||||
go2rtc: {
|
||||
stream: 'stream',
|
||||
url: '/local/path',
|
||||
},
|
||||
}),
|
||||
),
|
||||
).toEqual({
|
||||
endpoint: '/local/path/api/ws?src=stream',
|
||||
sign: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('with remote configuration', () => {
|
||||
expect(
|
||||
getDefaultGo2RTCEndpoint(
|
||||
createCameraConfig({
|
||||
go2rtc: {
|
||||
stream: 'stream',
|
||||
url: 'https://my-custom-go2rtc',
|
||||
},
|
||||
}),
|
||||
),
|
||||
).toEqual({
|
||||
endpoint: 'https://my-custom-go2rtc/api/ws?src=stream',
|
||||
sign: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('without configuration', () => {
|
||||
expect(getDefaultGo2RTCEndpoint(createCameraConfig())).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user