feat: Add experimental rewrite of go2rtc live provider (MSE/WebRTC/MP4/MJPEG) (#2580)

- Closes #2556
- Closes #2450

**Key intended features:**
 - go2rtc compatible
- 100% test coverage to significantly improve ability to test, maintain
and work around browser weirdnesses (e.g. Safari).
 - Written from the ground up in the style of the rest of the project.

**To use:**
 - Change `live_provider` from `go2rtc` to `go2rtc-experimental`.
This commit is contained in:
Dermot Duffy
2026-07-14 14:22:41 -07:00
committed by GitHub
parent 5662e48c22
commit c02c692f68
125 changed files with 9608 additions and 807 deletions
+30
View File
@@ -3,6 +3,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import * as go2rtcAudio from '../../src/camera-manager/utils/go2rtc/audio';
import {
getResolvedLiveProvider,
isGo2RTCLiveProvider,
liveProviderSupports2WayAudio,
} from '../../src/utils/live-provider';
import { createCameraConfig, createHASS } from '../test-utils';
@@ -66,6 +67,20 @@ describe('live-provider utils', () => {
});
});
describe('isGo2RTCLiveProvider', () => {
it('should return true for go2rtc', () => {
expect(isGo2RTCLiveProvider('go2rtc')).toBe(true);
});
it('should return true for go2rtc-experimental', () => {
expect(isGo2RTCLiveProvider('go2rtc-experimental')).toBe(true);
});
it('should return false for other providers', () => {
expect(isGo2RTCLiveProvider('ha')).toBe(false);
});
});
describe('liveProviderSupports2WayAudio', () => {
it('should return false if resolved provider is not go2rtc', async () => {
const config = createCameraConfig({
@@ -101,6 +116,21 @@ describe('live-provider utils', () => {
);
});
it('should support 2-way audio for the experimental provider', async () => {
const config = createCameraConfig({
live_provider: 'go2rtc-experimental',
});
const hass = createHASS();
vi.mocked(go2rtcAudio.supports2WayAudio).mockResolvedValue(true);
const result = await liveProviderSupports2WayAudio(
hass,
config,
config.go2rtc.metadata_fetch_timeout_seconds,
);
expect(result).toBe(true);
});
it('should pass metadata fetch timeout through to go2rtc detection', async () => {
const config = createCameraConfig({
live_provider: 'go2rtc',