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
+8 -5
View File
@@ -16,7 +16,8 @@ import { ifDefined } from 'lit/directives/if-defined.js';
import { dispatchLiveErrorEvent } from '../components-lib/live/utils/dispatch-live-error.js';
import { MediaLoadedInfoSourceController } from '../components-lib/media-loaded-info-source-controller.js';
import { VideoMediaPlayerController } from '../components-lib/media-player/video.js';
import { renderNotificationBlockFromText } from '../components/notification/block.js';
import { renderMediaNotification } from '../components/notification/media.js';
import { localize } from '../localize/localize.js';
import liveHAComponentsStyle from '../scss/live-ha-components.scss';
import type { MediaPlayer, MediaPlayerController } from '../types.js';
import {
@@ -112,8 +113,10 @@ void customElements.whenDefined('ha-web-rtc-player').then(() => {
protected render(): TemplateResult | void {
if (this._error) {
dispatchLiveErrorEvent(this);
return renderNotificationBlockFromText(this._error, {
metadata: [{ text: this.entityid, icon: 'mdi:cctv' }],
return renderMediaNotification({
title: localize('issues.media_unavailable.reasons.playback_error'),
detail: this._error,
targetTitle: this.entityid,
});
}
return html`
@@ -146,7 +149,7 @@ void customElements.whenDefined('ha-web-rtc-player').then(() => {
mediaPlayerController: this._mediaPlayerController,
capabilities: {
supportsPause: true,
hasAudio: hasAudio(this._videoEl, this._peerConnection),
hasAudio: hasAudio(this._videoEl, { pc: this._peerConnection }),
},
technology: ['webrtc'],
});
@@ -164,7 +167,7 @@ void customElements.whenDefined('ha-web-rtc-player').then(() => {
mediaPlayerController: this._mediaPlayerController,
capabilities: {
supportsPause: true,
hasAudio: hasAudio(this._videoEl, this._peerConnection),
hasAudio: hasAudio(this._videoEl, { pc: this._peerConnection }),
},
technology: ['webrtc'],
});