Add Frigate to set up
This commit is contained in:
parent
1ea643af8e
commit
957b74b126
|
@ -1 +1 @@
|
|||
2024.3.0
|
||||
2024.4.3
|
|
@ -39,9 +39,4 @@
|
|||
- service: switch.turn_off
|
||||
entity_id: switch.back_landscaping
|
||||
|
||||
# Arm the "alarm_control_panel.alexa_guard" alarm unless the "input_boolean.guest_mode" entity is "on"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ states.input_boolean.guest_mode.state != "on" }}
|
||||
- service: alarm_control_panel.alarm_arm_away
|
||||
entity_id: alarm_control_panel.alexa_guard
|
||||
|
||||
|
|
|
@ -94,12 +94,6 @@ logbook:
|
|||
logger: !include logger.yaml
|
||||
recorder: !include recorder.yaml
|
||||
|
||||
panel_iframe:
|
||||
dashy:
|
||||
title: 'Dashy'
|
||||
icon: 'mdi:dashboard'
|
||||
url: 'http://192.168.10.10:4000/'
|
||||
|
||||
# zwave:
|
||||
# usb_path: /dev/ttyACM0
|
||||
# config_path: /srv/hass/hass_venv/lib/python3.4/site-packages/libopenzwave-0.3.1-py3.4-linux-armv7l.egg/config
|
||||
|
|
|
@ -7,10 +7,10 @@ media_players:
|
|||
# - media_player.bedroom_alarm_panel
|
||||
- media_player.living_room
|
||||
- media_player.front_room_flex
|
||||
- media_player.garage
|
||||
- media_player.office
|
||||
- media_player.kitchen
|
||||
- media_player.justin_room
|
||||
- media_player.tap
|
||||
- media_player.upstairs
|
||||
- media_player.stacey_bedroom
|
||||
- media_player.carlo_bedroom
|
||||
|
|
|
@ -17,7 +17,7 @@ script:
|
|||
sequence:
|
||||
- service: media_player.play_media
|
||||
data:
|
||||
entity_id: media_player.tap
|
||||
entity_id: media_player.garage
|
||||
media_content_id: 'turn off paige bed'
|
||||
media_content_type: custom
|
||||
|
||||
|
@ -36,7 +36,7 @@ script:
|
|||
|
||||
- service: media_player.play_media
|
||||
data:
|
||||
entity_id: media_player.tap
|
||||
entity_id: media_player.garage
|
||||
media_content_id: 'turn off c life 3'
|
||||
media_content_type: custom
|
||||
|
||||
|
@ -44,7 +44,7 @@ script:
|
|||
|
||||
- service: media_player.play_media
|
||||
data:
|
||||
entity_id: media_player.tap
|
||||
entity_id: media_player.garage
|
||||
media_content_id: 'turn off c life 4'
|
||||
media_content_type: custom
|
||||
|
||||
|
@ -52,7 +52,7 @@ script:
|
|||
|
||||
- service: media_player.play_media
|
||||
data:
|
||||
entity_id: media_player.tap
|
||||
entity_id: media_player.garage
|
||||
media_content_id: 'turn off c sleep 1'
|
||||
media_content_type: custom
|
||||
|
||||
|
@ -60,6 +60,6 @@ script:
|
|||
|
||||
- service: media_player.play_media
|
||||
data:
|
||||
entity_id: media_player.tap
|
||||
entity_id: media_player.garage
|
||||
media_content_id: 'turn off c sleep 2'
|
||||
media_content_type: custom
|
||||
|
|
|
@ -83,16 +83,16 @@ automation:
|
|||
from: 'not_home'
|
||||
to: 'home'
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: cover.large_garage_door
|
||||
state: 'closed'
|
||||
- condition: state
|
||||
entity_id: cover.large_garage_door
|
||||
state: 'closed'
|
||||
action:
|
||||
- variables:
|
||||
person_triggered: "{{ trigger.to_state.entity_id.split('.')[1] }}"
|
||||
- service: script.notify_engine_two_button
|
||||
data:
|
||||
title: 'Welcome Home!'
|
||||
value1: 'Open Garage Door?'
|
||||
value1: 'Open Large Garage door?'
|
||||
title1: 'Yes'
|
||||
action1: 'OPEN_LARGE_GARAGE'
|
||||
icon1: 'sfsymbols:arrow.up.circle'
|
||||
|
@ -111,7 +111,7 @@ automation:
|
|||
event_type: mobile_app_notification_action
|
||||
event_data:
|
||||
action: OPEN_LARGE_GARAGE
|
||||
condition:
|
||||
conditions:
|
||||
- condition: state
|
||||
entity_id: cover.large_garage_door
|
||||
state: 'closed'
|
||||
|
@ -122,6 +122,43 @@ automation:
|
|||
- service: cover.open_cover
|
||||
entity_id: cover.large_garage_door
|
||||
|
||||
- alias: 'Prompt to Open Front Door'
|
||||
id: ece2b4a8-af21-41f4-a8fc-480a4d1ddabc
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: mobile_app_notification_action
|
||||
event_data:
|
||||
action: 'NO_OPEN_LARGE_GARAGE'
|
||||
conditions:
|
||||
- condition: state
|
||||
entity_id: group.family
|
||||
state: 'home'
|
||||
action:
|
||||
- service: script.notify_engine_two_button
|
||||
data:
|
||||
title: 'Unlock Front Door?'
|
||||
value1: 'Do you want to unlock the front door instead?'
|
||||
title1: 'Yes'
|
||||
action1: 'UNLOCK_FRONT_DOOR'
|
||||
icon1: 'sfsymbols:unlock'
|
||||
destructive1: 'false'
|
||||
title2: 'No'
|
||||
action2: 'KEEP_FRONT_DOOR_LOCKED'
|
||||
icon2: 'sfsymbols:lock'
|
||||
destructive2: 'true'
|
||||
who: "{{ person_triggered }}"
|
||||
group: 'Welcome_Home'
|
||||
|
||||
- alias: 'Unlock Front Door Action'
|
||||
id: c3106db1-f2c4-4800-b1a3-76d440228600
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: mobile_app_notification_action
|
||||
event_data:
|
||||
action: 'UNLOCK_FRONT_DOOR'
|
||||
action:
|
||||
- service: lock.unlock
|
||||
entity_id: lock.front_door
|
||||
|
||||
|
||||
######################################################################
|
||||
|
|
|
@ -9,9 +9,12 @@ include:
|
|||
exclude:
|
||||
domains:
|
||||
- device_tracker
|
||||
- camera
|
||||
entity_globs:
|
||||
- sensor.*uptime*
|
||||
- sensor.vpn_client_*
|
||||
- binary_sensor.*_motion
|
||||
- binary_sensor.*is_present
|
||||
entities:
|
||||
- automation.update_garage_get_status
|
||||
- binary_sensor.camera1_motion_sensor
|
||||
|
@ -20,7 +23,6 @@ exclude:
|
|||
- binary_sensor.powerwall_charging
|
||||
- media_player.carlo_s_4th_fire
|
||||
- media_player.alarm_panel_2
|
||||
- media_player.tap
|
||||
- script.speech_processing
|
||||
- script.amp_settings
|
||||
- sensor.carlo_ap
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}export{e as c,o as g};
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
const o=o=>void 0!==o.mozHasAudio?o.mozHasAudio:void 0===o.audioTracks||Boolean(o.audioTracks?.length);export{o as m};
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
import{dI as r,d8 as t,cL as n,l as a}from"./card-555679fd.js";const e=async(e,s,i,l)=>{if(!i.sign)return i.endpoint;let c;try{c=await r(s,i.endpoint,l)}catch(r){return t(r),null}return c?c.replace(/^http/i,"ws"):(n(e,a("error.failed_sign")),null)};export{e as g};
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
const e=1e4;export{e as C};
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
import{bS as e,d as n,bT as t}from"./card-555679fd.js";class r{getEngineType(){return e.Generic}async initializeCamera(e,n,t){return t}generateDefaultEventQuery(e,n,t){return null}generateDefaultRecordingQuery(e,n,t){return null}generateDefaultRecordingSegmentsQuery(e,n,t){return null}async getEvents(e,n,t,r){return null}async getRecordings(e,n,t,r){return null}async getRecordingSegments(e,n,t,r){return null}generateMediaFromEvents(e,n,t,r){return null}generateMediaFromRecordings(e,n,t,r){return null}async getMediaDownloadPath(e,n,t){return null}async favoriteMedia(e,n,t,r){}getQueryResultMaxAge(e){return null}async getMediaSeekTime(e,n,t,r,a){return null}async getMediaMetadata(e,n,t,r){return null}getCameraMetadata(e,r){return{title:r.title??n(e,r.camera_entity)??n(e,r.webrtc_card?.entity)??r.id??"",icon:r?.icon??t(e,r.camera_entity)??"mdi:video"}}getCameraCapabilities(e){return{canFavoriteEvents:!1,canFavoriteRecordings:!1,canSeek:!1,supportsClips:!1,supportsRecordings:!1,supportsSnapshots:!1,supportsTimeline:!1}}getMediaCapabilities(e){return null}getCameraEndpoints(e,n){return null}}export{r as GenericCameraManagerEngine};
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
import"./card-555679fd.js";
|
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1,33 @@
|
|||
import{di as e,cL as t,y as i,dj as s,dk as o,dl as r,dm as a,bj as n,dn as d,bk as l,bn as h}from"./card-555679fd.js";import{m as u}from"./audio-557099cb.js";import{h as c,s as v,M as y}from"./lazyload-c2d6254a.js";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/const p=({finisher:e,descriptor:t})=>(i,s)=>{var o;if(void 0===s){const s=null!==(o=i.originalKey)&&void 0!==o?o:i.key,r=null!=t?{kind:"method",placement:"prototype",key:s,descriptor:t(i.key)}:{...i,key:s};return null!=e&&(r.finisher=function(t){e(t,s)}),r}{const o=i.constructor;void 0!==t&&Object.defineProperty(i,s,t(s)),null==e||e(o,s)}}
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/;function m(e,t){return p({descriptor:i=>{const s={get(){var t,i;return null!==(i=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(e))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(t){const t="symbol"==typeof i?Symbol():"__"+i;s.get=function(){var i,s;return void 0===this[t]&&(this[t]=null!==(s=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(e))&&void 0!==s?s:null),this[t]}}return s}})}var _="img, video {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n}";customElements.whenDefined("ha-hls-player").then((()=>{let p=class extends(customElements.get("ha-hls-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(c(this._video),this._video.currentTime=e)}async setControls(e){this._video&&v(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){if(this._error){if(this._errorIsFatal)return t(this,this._error);console.error(this._error)}return i`
|
||||
<video
|
||||
id="video"
|
||||
?autoplay=${this.autoPlay}
|
||||
.muted=${this.muted}
|
||||
?playsinline=${this.playsInline}
|
||||
?controls=${this.controls}
|
||||
@loadedmetadata=${()=>{this.controls&&c(this._video,y)}}
|
||||
@loadeddata=${e=>{s(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:u(this._video)}})}}
|
||||
@volumechange=${()=>o(this)}
|
||||
@play=${()=>r(this)}
|
||||
@pause=${()=>a(this)}
|
||||
></video>
|
||||
`}static get styles(){return[super.styles,n(_),d`
|
||||
:host {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
`]}};l([m("#video")],p.prototype,"_video",void 0),p=l([h("frigate-card-ha-hls-player")],p)}));export{_ as c,m as i};
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
import{bY as t,dg as o,b_ as e,dh as n}from"./card-555679fd.js";function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function s(s,u){if(t(2,arguments),!u||"object"!==r(u))return new Date(NaN);var a=u.years?e(u.years):0,y=u.months?e(u.months):0,f=u.weeks?e(u.weeks):0,c=u.days?e(u.days):0,i=u.hours?e(u.hours):0,m=u.minutes?e(u.minutes):0,b=u.seconds?e(u.seconds):0,p=function(o,r){t(2,arguments);var s=e(r);return n(o,-s)}(s,y+12*a),d=function(n,r){t(2,arguments);var s=e(r);return o(n,-s)}(p,c+7*f),l=1e3*(b+60*(m+60*i));return new Date(d.getTime()-l)}export{s};
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1,127 @@
|
|||
import{cH as e,cI as i,cJ as t,cK as a,cL as r,l as s,cM as o,s as n,cN as d,y as l,bj as h,bk as c,bl as g,cO as u,bm as m,bn as v,cP as p,bQ as f,cQ as _,cR as C,cS as b,cT as $,cU as y,cV as w,o as P}from"./card-555679fd.js";import{L as M,A as S,i as k,w as x,a as L,p as I}from"./lazyload-c2d6254a.js";import{u as z}from"./media-layout-8e0c974f.js";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/const E=e(class extends i{constructor(){super(...arguments),this.key=t}render(e,i){return this.key=e,i}update(e,[i,t]){return i!==this.key&&(a(e),this.key=i),t}});const R="frigate-card-live-provider",O=(e,i,t)=>{if(!t?.camera_entity)return r(e,s("error.no_live_camera"),{context:t}),null;const a=i.states[t.camera_entity];return a?"unavailable"===a.state?(o(e,s("error.live_camera_unavailable"),"info",{icon:"mdi:connection",context:t}),null):a:(r(e,s("error.live_camera_not_found"),{context:t}),null)};let V=class extends n{constructor(){super(),this._inBackground=!1,this._lastMediaLoadedInfo=null,this._messageReceivedPostRender=!1,this._renderKey=0,this._intersectionObserver=new IntersectionObserver(this._intersectionHandler.bind(this))}_intersectionHandler(e){this._inBackground=!e.some((e=>e.isIntersecting)),this._inBackground||this._messageReceivedPostRender||!this._lastMediaLoadedInfo||d(this._lastMediaLoadedInfo.source,this._lastMediaLoadedInfo.mediaLoadedInfo),this._messageReceivedPostRender&&!this._inBackground&&this.requestUpdate()}shouldUpdate(e){return!this._inBackground||!this._messageReceivedPostRender}connectedCallback(){this._intersectionObserver.observe(this),super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._intersectionObserver.disconnect()}render(){if(!(this.hass&&this.liveConfig&&this.cameraManager&&this.view))return;const e=l`${E(this._renderKey,l`
|
||||
<frigate-card-live-carousel
|
||||
.hass=${this.hass}
|
||||
.view=${this.view}
|
||||
.liveConfig=${this.liveConfig}
|
||||
.inBackground=${this._inBackground}
|
||||
.conditionControllerEpoch=${this.conditionControllerEpoch}
|
||||
.liveOverrides=${this.liveOverrides}
|
||||
.cardWideConfig=${this.cardWideConfig}
|
||||
.cameraManager=${this.cameraManager}
|
||||
.microphoneStream=${this.microphoneStream}
|
||||
@frigate-card:message=${e=>{this._renderKey++,this._messageReceivedPostRender=!0,this._inBackground&&e.stopPropagation()}}
|
||||
@frigate-card:media:loaded=${e=>{this._lastMediaLoadedInfo={source:e.composedPath()[0],mediaLoadedInfo:e.detail},this._inBackground&&e.stopPropagation()}}
|
||||
@frigate-card:view:change=${e=>{this._inBackground&&e.stopPropagation()}}
|
||||
>
|
||||
</frigate-card-live-carousel>
|
||||
`)}`;return this._messageReceivedPostRender=!1,e}static get styles(){return h(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};c([g({attribute:!1})],V.prototype,"conditionControllerEpoch",void 0),c([g({attribute:!1})],V.prototype,"hass",void 0),c([g({attribute:!1})],V.prototype,"view",void 0),c([g({attribute:!1})],V.prototype,"liveConfig",void 0),c([g({attribute:!1,hasChanged:u})],V.prototype,"liveOverrides",void 0),c([g({attribute:!1})],V.prototype,"cameraManager",void 0),c([g({attribute:!1})],V.prototype,"cardWideConfig",void 0),c([g({attribute:!1})],V.prototype,"microphoneStream",void 0),c([m()],V.prototype,"_inBackground",void 0),V=c([v("frigate-card-live")],V);let j=class extends n{constructor(){super(...arguments),this._cameraToSlide={},this._refMediaCarousel=p()}updated(e){super.updated(e),e.has("inBackground")&&this.updateComplete.then((async()=>{const e=this._refMediaCarousel.value;e&&(await e.updateComplete,this.inBackground?(e.autoPause(),e.autoMute()):(e.autoPlay(),e.autoUnmute()))}))}_getTransitionEffect(){return this.liveConfig?.transition_effect??f.live.transition_effect}_getSelectedCameraIndex(){const e=this.cameraManager?.getStore().getVisibleCameraIDs();return e&&this.view?Math.max(0,Array.from(e).indexOf(this.view.camera)):0}_getOptions(){return{draggable:this.liveConfig?.draggable,loop:!0}}_getPlugins(){const e=this.cameraManager?.getStore().getVisibleCameraIDs();return[...e&&e.size>1?[_({forceWheelAxis:"y"})]:[],M({...this.liveConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadOrUnloadSlide("load",e,i)},lazyUnloadCondition:this.liveConfig?.lazy_unload,lazyUnloadCallback:(e,i)=>this._lazyloadOrUnloadSlide("unload",e,i)}),S({playerSelector:R,...this.liveConfig?.auto_play&&{autoPlayCondition:this.liveConfig.auto_play},...this.liveConfig?.auto_pause&&{autoPauseCondition:this.liveConfig.auto_pause},...this.liveConfig?.auto_mute&&{autoMuteCondition:this.liveConfig.auto_mute},...this.liveConfig?.auto_unmute&&{autoUnmuteCondition:this.liveConfig.auto_unmute}})]}_getLazyLoadCount(){return!1===this.liveConfig?.lazy_load?null:0}_getSlides(){const e=this.cameraManager?.getStore().getVisibleCameras();if(!e)return[[],{}];const i=[],t={};for(const[a,r]of e){const e=this.view?.context?.live?.overrides?.get(a)??a,s=a===e?r:this.cameraManager?.getStore().getCameraConfig(e),o=s?this._renderLive(e,s,i.length):null;o&&(t[a]=i.length,i.push(o))}return[i,t]}_setViewHandler(e){const i=this.cameraManager?.getStore().getVisibleCameras();i&&e.detail.index!==this._getSelectedCameraIndex()&&this._setViewCameraID(Array.from(i.keys())[e.detail.index])}_setViewCameraID(e){e&&this.view?.evolve({camera:e,query:null,queryResults:null}).mergeInContext({thumbnails:{fetch:!1}}).dispatchChangeEvent(this)}_lazyloadOrUnloadSlide(e,i,t){t instanceof HTMLSlotElement&&(t=t.assignedElements({flatten:!0})[0]);const a=t?.querySelector(R);a&&(a.disabled="load"!==e)}_renderLive(e,i,t){if(!(this.liveConfig&&this.hass&&this.cameraManager&&this.conditionControllerEpoch))return;const a=C(this.conditionControllerEpoch.controller,this.liveConfig,this.liveOverrides,{camera:e}),r=this.cameraManager.getCameraMetadata(this.hass,e);return l`
|
||||
<div class="embla__slide">
|
||||
<frigate-card-live-provider
|
||||
?disabled=${this.liveConfig.lazy_load}
|
||||
.microphoneStream=${this.view?.camera===e?this.microphoneStream:void 0}
|
||||
.cameraConfig=${i}
|
||||
.cameraEndpoints=${k([this.cameraManager,e],(()=>this.cameraManager?.getCameraEndpoints(e)??void 0))}
|
||||
.label=${r?.title??""}
|
||||
.liveConfig=${a}
|
||||
.hass=${this.hass}
|
||||
.cardWideConfig=${this.cardWideConfig}
|
||||
@frigate-card:media:loaded=${e=>{x(t,e)}}
|
||||
@frigate-card:media:unloaded=${e=>{L(t,e)}}
|
||||
>
|
||||
</frigate-card-live-provider>
|
||||
</div>
|
||||
`}_getCameraIDsOfNeighbors(){const e=this.cameraManager?.getStore().getVisibleCameras();if(!e||!this.view||!this.hass)return[null,null];const i=Array.from(e.keys()),t=i.indexOf(this.view.camera);return t<0||e.size<=1?[null,null]:[i[t>0?t-1:e.size-1],i[t+1<e.size?t+1:0]]}render(){if(!(this.liveConfig&&this.view&&this.hass&&this.cameraManager))return;const[e,i]=this._getSlides();if(this._cameraToSlide=i,!e.length)return;const[t,a]=this._getCameraIDsOfNeighbors(),r=e=>this.view?.context?.live?.overrides?.get(e)??e,o=t?this.cameraManager.getCameraMetadata(this.hass,r(t)):null,n=this.cameraManager.getCameraMetadata(this.hass,r(this.view.camera)),d=a?this.cameraManager.getCameraMetadata(this.hass,r(a)):null;return l`
|
||||
<frigate-card-media-carousel
|
||||
${b(this._refMediaCarousel)}
|
||||
.carouselOptions=${k([this.cameraManager,this.liveConfig],this._getOptions.bind(this))}
|
||||
.carouselPlugins=${k([this.cameraManager,this.liveConfig],this._getPlugins.bind(this))}
|
||||
.label="${n?`${s("common.live")}: ${n.title}`:""}"
|
||||
.logo="${n?.engineLogo}"
|
||||
.titlePopupConfig=${this.liveConfig.controls.title}
|
||||
.selected=${this._getSelectedCameraIndex()}
|
||||
transitionEffect=${this._getTransitionEffect()}
|
||||
@frigate-card:media-carousel:select=${this._setViewHandler.bind(this)}
|
||||
@frigate-card:carousel:settle=${()=>{$(this,{thumbnails:{fetch:!0}})}}
|
||||
>
|
||||
<frigate-card-next-previous-control
|
||||
slot="previous"
|
||||
.hass=${this.hass}
|
||||
.direction=${"previous"}
|
||||
.controlConfig=${this.liveConfig.controls.next_previous}
|
||||
.label=${o?.title??""}
|
||||
.icon=${o?.icon}
|
||||
?disabled=${null===t}
|
||||
@click=${e=>{this._setViewCameraID(t),y(e)}}
|
||||
>
|
||||
</frigate-card-next-previous-control>
|
||||
${e}
|
||||
<frigate-card-next-previous-control
|
||||
slot="next"
|
||||
.hass=${this.hass}
|
||||
.direction=${"next"}
|
||||
.controlConfig=${this.liveConfig.controls.next_previous}
|
||||
.label=${d?.title??""}
|
||||
.icon=${d?.icon}
|
||||
?disabled=${null===a}
|
||||
@click=${e=>{this._setViewCameraID(a),y(e)}}
|
||||
>
|
||||
</frigate-card-next-previous-control>
|
||||
</frigate-card-media-carousel>
|
||||
`}static get styles(){return h(".embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};c([g({attribute:!1})],j.prototype,"hass",void 0),c([g({attribute:!1})],j.prototype,"view",void 0),c([g({attribute:!1})],j.prototype,"liveConfig",void 0),c([g({attribute:!1,hasChanged:u})],j.prototype,"liveOverrides",void 0),c([g({attribute:!1})],j.prototype,"inBackground",void 0),c([g({attribute:!1})],j.prototype,"conditionControllerEpoch",void 0),c([g({attribute:!1})],j.prototype,"cardWideConfig",void 0),c([g({attribute:!1})],j.prototype,"cameraManager",void 0),c([g({attribute:!1})],j.prototype,"microphoneStream",void 0),j=c([v("frigate-card-live-carousel")],j);let B=class extends n{constructor(){super(...arguments),this.disabled=!1,this.label="",this._isVideoMediaLoaded=!1,this._refProvider=p(),this._importPromises=[]}async play(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await I(this,this._refProvider.value)}async pause(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.pause())}async mute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.mute())}async unmute(){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.unmute())}isMuted(){return this._refProvider.value?.isMuted()??!0}async seek(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.seek(e))}async setControls(e){await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.setControls(e))}isPaused(){return this._refProvider.value?.isPaused()??!0}async getScreenshotURL(){return await this.updateComplete,await(this._refProvider.value?.updateComplete),await(this._refProvider.value?.getScreenshotURL())??null}_getResolvedProvider(){return"auto"===this.cameraConfig?.live_provider?this.cameraConfig?.webrtc_card?.entity||this.cameraConfig?.webrtc_card?.url?"webrtc-card":this.cameraConfig?.camera_entity?"low"===this.cardWideConfig?.performance?.profile?"image":"ha":this.cameraConfig?.frigate.camera_name?"jsmpeg":f.cameras.live_provider:this.cameraConfig?.live_provider||"image"}_shouldShowImageDuringLoading(){return!!this.cameraConfig?.camera_entity&&!!this.hass&&!!this.liveConfig?.show_image_during_load}disconnectedCallback(){this._isVideoMediaLoaded=!1}_videoMediaShowHandler(){this._isVideoMediaLoaded=!0}willUpdate(e){if(e.has("disabled")&&this.disabled&&(this._isVideoMediaLoaded=!1,w(this)),e.has("liveConfig")&&(z(this,this.liveConfig?.layout),this.liveConfig?.show_image_during_load&&this._importPromises.push(import("./live-image-c8850fc4.js")),this.liveConfig?.zoomable&&this._importPromises.push(import("./zoomer-1857311a.js"))),e.has("cameraConfig")){const e=this._getResolvedProvider();"jsmpeg"===e?this._importPromises.push(import("./live-jsmpeg-9c767737.js")):"ha"===e?this._importPromises.push(import("./live-ha-df63bfc8.js")):"webrtc-card"===e?this._importPromises.push(import("./live-webrtc-card-dfc8f852.js")):"image"===e?this._importPromises.push(import("./live-image-c8850fc4.js")):"go2rtc"===e&&this._importPromises.push(import("./live-go2rtc-0795a62f.js"))}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await Promise.all(this._importPromises),this._importPromises=[],e}_useZoomIfRequired(e){return this.liveConfig?.zoomable?l` <frigate-card-zoomer
|
||||
@frigate-card:zoom:zoomed=${()=>this.setControls(!1)}
|
||||
@frigate-card:zoom:unzoomed=${()=>this.setControls()}
|
||||
>
|
||||
${e}
|
||||
</frigate-card-zoomer>`:e}render(){if(this.disabled||!this.hass||!this.liveConfig||!this.cameraConfig)return;this.title=this.label,this.ariaLabel=this.label;const e=this._getResolvedProvider(),i=!this._isVideoMediaLoaded&&this._shouldShowImageDuringLoading(),t={hidden:i};return this._useZoomIfRequired(l`
|
||||
${i||"image"===e?l` <frigate-card-live-image
|
||||
${b(this._refProvider)}
|
||||
.hass=${this.hass}
|
||||
.cameraConfig=${this.cameraConfig}
|
||||
@frigate-card:media:loaded=${i=>{"image"===e?this._videoMediaShowHandler():i.stopPropagation()}}
|
||||
>
|
||||
</frigate-card-live-image>`:l``}
|
||||
${"ha"===e?l` <frigate-card-live-ha
|
||||
${b(this._refProvider)}
|
||||
class=${P(t)}
|
||||
.hass=${this.hass}
|
||||
.cameraConfig=${this.cameraConfig}
|
||||
?controls=${this.liveConfig.controls.builtin}
|
||||
@frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)}
|
||||
>
|
||||
</frigate-card-live-ha>`:"go2rtc"===e?l`<frigate-card-live-go2rtc
|
||||
${b(this._refProvider)}
|
||||
class=${P(t)}
|
||||
.hass=${this.hass}
|
||||
.cameraConfig=${this.cameraConfig}
|
||||
.cameraEndpoints=${this.cameraEndpoints}
|
||||
.microphoneStream=${this.microphoneStream}
|
||||
.microphoneConfig=${this.liveConfig.microphone}
|
||||
?controls=${this.liveConfig.controls.builtin}
|
||||
@frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)}
|
||||
>
|
||||
</frigate-card-live-webrtc-card>`:"webrtc-card"===e?l`<frigate-card-live-webrtc-card
|
||||
${b(this._refProvider)}
|
||||
class=${P(t)}
|
||||
.hass=${this.hass}
|
||||
.cameraConfig=${this.cameraConfig}
|
||||
.cameraEndpoints=${this.cameraEndpoints}
|
||||
.cardWideConfig=${this.cardWideConfig}
|
||||
?controls=${this.liveConfig.controls.builtin}
|
||||
@frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)}
|
||||
>
|
||||
</frigate-card-live-webrtc-card>`:"jsmpeg"===e?l` <frigate-card-live-jsmpeg
|
||||
${b(this._refProvider)}
|
||||
class=${P(t)}
|
||||
.hass=${this.hass}
|
||||
.cameraConfig=${this.cameraConfig}
|
||||
.cameraEndpoints=${this.cameraEndpoints}
|
||||
.cardWideConfig=${this.cardWideConfig}
|
||||
@frigate-card:media:loaded=${this._videoMediaShowHandler.bind(this)}
|
||||
>
|
||||
</frigate-card-live-jsmpeg>`:l``}
|
||||
`)}static get styles(){return h(":host {\n display: block;\n height: 100%;\n width: 100;\n}\n\n.hidden {\n display: none;\n}")}};c([g({attribute:!1})],B.prototype,"hass",void 0),c([g({attribute:!1})],B.prototype,"cameraConfig",void 0),c([g({attribute:!1})],B.prototype,"cameraEndpoints",void 0),c([g({attribute:!1})],B.prototype,"liveConfig",void 0),c([g({attribute:!0,type:Boolean})],B.prototype,"disabled",void 0),c([g({attribute:!1})],B.prototype,"label",void 0),c([g({attribute:!1})],B.prototype,"cardWideConfig",void 0),c([g({attribute:!1})],B.prototype,"microphoneStream",void 0),c([m()],B.prototype,"_isVideoMediaLoaded",void 0),B=c([v(R)],B);export{V as FrigateCardLive,j as FrigateCardLiveCarousel,B as FrigateCardLiveProvider,O as getStateObjOrDispatchError};
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1,61 @@
|
|||
import{di as e,cL as t,y as s,dj as a,dk as r,dl as i,dm as h,bj as o,dn as l,bk as n,bn as d,s as u,cP as c,cS as y,bl as p}from"./card-555679fd.js";import{getStateObjOrDispatchError as m}from"./live-e0c9196c.js";import{c as _,i as v}from"./ha-hls-player-aef987da.js";import{m as f}from"./audio-557099cb.js";import{s as $,h as g,M as b}from"./lazyload-c2d6254a.js";import"./media-layout-8e0c974f.js";customElements.whenDefined("ha-web-rtc-player").then((()=>{let u=class extends(customElements.get("ha-web-rtc-player")){async play(){return this._video?.play()}async pause(){this._video?.pause()}async mute(){this._video&&(this._video.muted=!0)}async unmute(){this._video&&(this._video.muted=!1)}isMuted(){return this._video?.muted??!0}async seek(e){this._video&&(this._video.currentTime=e)}async setControls(e){this._video&&$(this._video,e??this.controls)}isPaused(){return this._video?.paused??!0}async getScreenshotURL(){return this._video?e(this._video):null}render(){return this._error?t(this,`${this._error} (${this.entityid})`):s`
|
||||
<video
|
||||
id="remote-stream"
|
||||
?autoplay=${this.autoPlay}
|
||||
.muted=${this.muted}
|
||||
?playsinline=${this.playsInline}
|
||||
?controls=${this.controls}
|
||||
@loadedmetadata=${()=>{this.controls&&g(this._video,b)}}
|
||||
@loadeddata=${e=>{a(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:f(this._video)}})}}
|
||||
@volumechange=${()=>r(this)}
|
||||
@play=${()=>i(this)}
|
||||
@pause=${()=>h(this)}
|
||||
></video>
|
||||
`}static get styles(){return[super.styles,o(_),l`
|
||||
:host {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
`]}};n([v("#remote-stream")],u.prototype,"_video",void 0),u=n([d("frigate-card-ha-web-rtc-player")],u)})),customElements.whenDefined("ha-camera-stream").then((()=>{let e=class extends(customElements.get("ha-camera-stream")){async play(){return this._player?.play()}async pause(){this._player?.pause()}async mute(){this._player?.mute()}async unmute(){this._player?.unmute()}isMuted(){return this._player?.isMuted()??!0}async seek(e){this._player?.seek(e)}async setControls(e){this._player&&this._player.setControls(e??this.controls)}isPaused(){return this._player?.isPaused()??!0}async getScreenshotURL(){return this._player?await this._player.getScreenshotURL():null}render(){return this.stateObj?this._shouldRenderMJPEG?s`
|
||||
<img
|
||||
@load=${e=>{a(this,e,{player:this})}}
|
||||
.src=${void 0===this._connected||this._connected?(e=this.stateObj,`/api/camera_proxy_stream/${e.entity_id}?token=${e.attributes.access_token}`):""}
|
||||
/>
|
||||
`:"hls"===this.stateObj.attributes.frontend_stream_type?this._url?s` <frigate-card-ha-hls-player
|
||||
id="player"
|
||||
?autoplay=${!1}
|
||||
playsinline
|
||||
.allowExoPlayer=${this.allowExoPlayer}
|
||||
.muted=${this.muted}
|
||||
.controls=${this.controls}
|
||||
.hass=${this.hass}
|
||||
.url=${this._url}
|
||||
></frigate-card-ha-hls-player>`:s``:"web_rtc"===this.stateObj.attributes.frontend_stream_type?s`<frigate-card-ha-web-rtc-player
|
||||
id="player"
|
||||
?autoplay=${!1}
|
||||
playsinline
|
||||
.muted=${this.muted}
|
||||
.controls=${this.controls}
|
||||
.hass=${this.hass}
|
||||
.entityid=${this.stateObj.entity_id}
|
||||
></frigate-card-ha-web-rtc-player>`:void 0:s``;var e}static get styles(){return[super.styles,o(_),l`
|
||||
:host {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
`]}};n([v("#player")],e.prototype,"_player",void 0),e=n([d("frigate-card-ha-camera-stream")],e)}));let w=class extends u{constructor(){super(...arguments),this.controls=!0,this._playerRef=c()}async play(){return this._playerRef.value?.play()}async pause(){this._playerRef.value?.pause()}async mute(){this._playerRef.value?.mute()}async unmute(){this._playerRef.value?.unmute()}isMuted(){return this._playerRef.value?.isMuted()??!0}async seek(e){this._playerRef.value?.seek(e)}async setControls(e){this._playerRef.value?.setControls(e??this.controls)}isPaused(){return this._playerRef.value?.isPaused()??!0}async getScreenshotURL(){return await(this._playerRef.value?.getScreenshotURL())??null}render(){if(!this.hass)return;const e=m(this,this.hass,this.cameraConfig);return e?s` <frigate-card-ha-camera-stream
|
||||
${y(this._playerRef)}
|
||||
.hass=${this.hass}
|
||||
.stateObj=${e}
|
||||
.controls=${this.controls}
|
||||
.muted=${!0}
|
||||
>
|
||||
</frigate-card-ha-camera-stream>`:void 0}static get styles(){return o(":host {\n width: 100%;\n height: 100%;\n display: block;\n --video-max-height: none;\n}")}};n([p({attribute:!1})],w.prototype,"hass",void 0),n([p({attribute:!1})],w.prototype,"cameraConfig",void 0),n([p({attribute:!0,type:Boolean})],w.prototype,"controls",void 0),w=n([d("frigate-card-live-ha")],w);export{w as FrigateCardLiveHA};
|
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
import{s as e,cP as a,y as s,cS as t,bj as i,bk as r,bl as m,bn as o}from"./card-555679fd.js";import"./image-0b99ab11.js";import{getStateObjOrDispatchError as n}from"./live-e0c9196c.js";import"./media-layout-8e0c974f.js";import"./lazyload-c2d6254a.js";let u=class extends e{constructor(){super(...arguments),this._refImage=a()}async play(){await(this._refImage.value?.play())}async pause(){await(this._refImage.value?.pause())}async mute(){await(this._refImage.value?.mute())}async unmute(){await(this._refImage.value?.unmute())}isMuted(){return!!this._refImage.value?.isMuted()}async seek(e){await(this._refImage.value?.seek(e))}async setControls(e){await(this._refImage.value?.setControls(e))}isPaused(){return this._refImage.value?.isPaused()??!0}async getScreenshotURL(){return await(this._refImage.value?.getScreenshotURL())??null}render(){if(this.hass&&this.cameraConfig)return n(this,this.hass,this.cameraConfig),s` <frigate-card-image
|
||||
${t(this._refImage)}
|
||||
.imageConfig=${{mode:this.cameraConfig.image.url?"url":"camera",refresh_seconds:this.cameraConfig.image.refresh_seconds,url:this.cameraConfig.image.url,zoomable:!1}}
|
||||
.hass=${this.hass}
|
||||
.cameraConfig=${this.cameraConfig}
|
||||
>
|
||||
</frigate-card-image>`}static get styles(){return i(":host {\n width: 100%;\n height: 100%;\n display: block;\n}")}};r([m({attribute:!1})],u.prototype,"hass",void 0),r([m({attribute:!1})],u.prototype,"cameraConfig",void 0),u=r([o("frigate-card-live-image")],u);export{u as FrigateCardLiveImage};
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
import{s as t,dJ as e,di as a,cZ as r,dj as s,dl as n,dm as o,dk as i,bj as c,bk as d,bl as l,bn as u,db as h,l as p,cL as b,bX as y,y as g}from"./card-555679fd.js";import{m}from"./audio-557099cb.js";import{s as w,h as _,M as f}from"./lazyload-c2d6254a.js";let C=class extends t{constructor(){super(...arguments),this.controls=!1,this._webrtcTask=new e(this,this._getWebRTCCardElement,(()=>[1]))}async play(){return this._getPlayer()?.play()}async pause(){this._getPlayer()?.pause()}async mute(){const t=this._getPlayer();t&&(t.muted=!0)}async unmute(){const t=this._getPlayer();t&&(t.muted=!1)}isMuted(){return this._getPlayer()?.muted??!0}async seek(t){const e=this._getPlayer();e&&(e.currentTime=t)}async setControls(t){const e=this._getPlayer();e&&w(e,t??this.controls)}isPaused(){return this._getPlayer()?.paused??!0}async getScreenshotURL(){const t=this._getPlayer();return t?a(t):null}connectedCallback(){super.connectedCallback(),this.requestUpdate()}_getPlayer(){const t=this.renderRoot?.querySelector("#webrtc");return t?.video??null}async _getWebRTCCardElement(){return await customElements.whenDefined("webrtc-camera"),customElements.get("webrtc-camera")}_createWebRTC(){const t=this._webrtcTask.value;if(t&&this.hass&&this.cameraConfig){const e=new t,a={...this.cameraConfig.webrtc_card};return a.url||a.entity||!this.cameraEndpoints?.webrtcCard||(a.url=this.cameraEndpoints.webrtcCard.endpoint),e.setConfig(a),e.hass=this.hass,e}return null}render(){return r(this,this._webrtcTask,(()=>{let t;try{t=this._createWebRTC()}catch(t){return b(this,t instanceof y?t.message:p("error.webrtc_card_reported_error")+": "+t.message,{context:t.context})}return t&&(t.id="webrtc"),g`${t}`}),{inProgressFunc:()=>h({message:p("error.webrtc_card_waiting"),cardWideConfig:this.cardWideConfig})})}updated(){this.updateComplete.then((()=>{const t=this._getPlayer();t&&(w(t,this.controls),t.onloadeddata=()=>{this.controls&&_(t,f),s(this,t,{player:this,capabilities:{supportsPause:!0,hasAudio:m(t)}})},t.onplay=()=>n(this),t.onpause=()=>o(this),t.onvolumechange=()=>i(this))}))}static get styles(){return c(":host {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n/* Don't drop shadow or have radius for nested webrtc card */\n#webrtc ha-card {\n border-radius: 0px;\n margin: 0px;\n box-shadow: none;\n}\n\nha-card,\ndiv.fix-safari,\n#video {\n background: unset;\n background-color: unset;\n}\n\n#webrtc #video {\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n}")}};d([l({attribute:!1})],C.prototype,"cameraConfig",void 0),d([l({attribute:!1})],C.prototype,"cameraEndpoints",void 0),d([l({attribute:!1})],C.prototype,"cardWideConfig",void 0),d([l({attribute:!0,type:Boolean})],C.prototype,"controls",void 0),C=d([u("frigate-card-live-webrtc-card")],C);export{C as FrigateCardLiveWebRTCCard};
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
var e;!function(e){e.MP4="mp4",e.HLS="hls"}(e||(e={}));class t{constructor(e,t){this._mediaType=e,this._cameraID=t}getContentType(){return"snapshot"===this._mediaType?"image":"video"}getCameraID(){return this._cameraID}getMediaType(){return this._mediaType}getVideoContentType(){return null}getID(){return null}getStartTime(){return null}getEndTime(){return null}getUsableEndTime(){return this.getEndTime()??(this.inProgress()?new Date:this.getStartTime())}inProgress(){return null}getContentID(){return null}getTitle(){return null}getThumbnail(){return null}isFavorite(){return null}includesTime(e){const t=this.getStartTime(),r=this.getUsableEndTime();return!!t&&!!r&&e>=t&&e<=r}setFavorite(e){}getWhere(){return null}}export{t as V,e as a};
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
const t=(t,o)=>{void 0!==o?.fit?t.style.setProperty("--frigate-card-media-layout-fit",o.fit):t.style.removeProperty("--frigate-card-media-layout-fit");for(const e of["x","y"])void 0!==o?.position?.[e]?t.style.setProperty(`--frigate-card-media-layout-position-${e}`,`${o.position[e]}%`):t.style.removeProperty(`--frigate-card-media-layout-position-${e}`)};export{t as u};
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
import{c1 as o}from"./card-555679fd.js";function t(t,n){return n="function"==typeof n?n:void 0,t&&t.length?o(t,void 0,n):[]}export{t as u};
|
Binary file not shown.
|
@ -0,0 +1,104 @@
|
|||
import{s as e,d9 as i,da as t,db as a,y as s,bj as r,bk as o,bl as d,bn as l,cP as n,bQ as h,cQ as u,cM as v,l as c,cS as g,cU as f,cO as p,di as m,c5 as w,d7 as y,d8 as C,de as _,ck as b,cl as $,dj as M,dk as P,dl as R,dm as x}from"./card-555679fd.js";import{L as q,A as V,i as S,w as I,p as T,h as F,s as k,M as z}from"./lazyload-c2d6254a.js";import"./ha-hls-player-aef987da.js";import{m as W}from"./audio-557099cb.js";import{u as j}from"./media-layout-8e0c974f.js";import{a as E}from"./media-b0eb3f2a.js";let D=class extends e{render(){if(this.hass&&this.view&&this.viewerConfig&&this.cameraManager&&this.cardWideConfig){if(!this.view.queryResults?.hasResults()){const e=this.view.getDefaultMediaType();if(!e)return;return"recordings"===e?i(this,this.hass,this.cameraManager,this.cardWideConfig,this.view,{targetView:"recording",select:"latest"}):t(this,this.hass,this.cameraManager,this.cardWideConfig,this.view,{targetView:"media",mediaType:e,select:"latest"}),a({cardWideConfig:this.cardWideConfig})}return s`
|
||||
<frigate-card-viewer-carousel
|
||||
.hass=${this.hass}
|
||||
.view=${this.view}
|
||||
.viewerConfig=${this.viewerConfig}
|
||||
.resolvedMediaCache=${this.resolvedMediaCache}
|
||||
.cameraManager=${this.cameraManager}
|
||||
.cardWideConfig=${this.cardWideConfig}
|
||||
>
|
||||
</frigate-card-viewer-carousel>
|
||||
`}}static get styles(){return r(":host {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n\nfrigate-card-viewer-carousel {\n flex: 1;\n min-height: 0;\n}")}};o([d({attribute:!1})],D.prototype,"hass",void 0),o([d({attribute:!1})],D.prototype,"view",void 0),o([d({attribute:!1})],D.prototype,"viewerConfig",void 0),o([d({attribute:!1})],D.prototype,"resolvedMediaCache",void 0),o([d({attribute:!1})],D.prototype,"cameraManager",void 0),o([d({attribute:!1})],D.prototype,"cardWideConfig",void 0),D=o([l("frigate-card-viewer")],D);const H="frigate-card-viewer-provider";let L=class extends e{constructor(){super(...arguments),this._refMediaCarousel=n()}updated(e){if(super.updated(e),e.has("view")){const i=e.get("view");this.view?.context?.mediaViewer!==i?.context?.mediaViewer&&this._seekHandler()}}_getTransitionEffect(){return this.viewerConfig?.transition_effect??h.media_viewer.transition_effect}_getPlayer(e){return e||(e=this._refMediaCarousel.value?.frigateCardCarousel()?.getCarouselSelected()?.element),e?.querySelector(H)??null}_getPlugins(){return[...this.view?.queryResults?.getResultsCount()?[u({forceWheelAxis:"y"})]:[],q({...this.viewerConfig?.lazy_load&&{lazyLoadCallback:(e,i)=>this._lazyloadSlide(i)}}),V({playerSelector:H,...this.viewerConfig?.auto_play&&{autoPlayCondition:this.viewerConfig.auto_play},...this.viewerConfig?.auto_pause&&{autoPauseCondition:this.viewerConfig.auto_pause},...this.viewerConfig?.auto_mute&&{autoMuteCondition:this.viewerConfig.auto_mute},...this.viewerConfig?.auto_unmute&&{autoUnmuteCondition:this.viewerConfig.auto_unmute}})]}_getMediaNeighbors(){const e=this.view?.queryResults?.getSelectedIndex()??null,i=this.view?.queryResults?.getResultsCount()??0;if(!this.view||!this.view.queryResults||null===e)return[null,null];return[e>0?this.view.queryResults.getResult(e-1):null,e+1<i?this.view.queryResults.getResult(e+1):null]}_setViewHandler(e){this._setViewSelectedIndex(e.detail.index)}_setViewSelectedIndex(e){if(!this.view?.queryResults)return;const i=this.view.queryResults.getSelectedIndex();if(null===i||i===e)return;const t=this.view?.queryResults?.clone().selectResult(e);if(!t)return;const a=t.getSelectedResult()?.getCameraID();this.view?.evolve({queryResults:t,...a&&{camera:a}}).dispatchChangeEvent(this)}_lazyloadSlide(e){e instanceof HTMLSlotElement&&(e=e.assignedElements({flatten:!0})[0]);const i=e?.querySelector("frigate-card-viewer-provider");i&&(i.disabled=!1)}_getSlides(){if(!this.view||!this.view.queryResults)return[];const e=[];for(let i=0;i<this.view.queryResults.getResultsCount();++i){const t=this.view.queryResults.getResult(i);if(t){const a=this._renderMediaItem(t,i);a&&(e[i]=a)}}return e}willUpdate(e){e.has("viewerConfig")&&j(this,this.viewerConfig?.layout)}render(){const e=this.view?.queryResults?.getResultsCount()??0;if(!e)return v(this,c("common.no_media"),"info",{icon:"mdi:multimedia"});const i=this.view?.queryResults?.getSelectedResult()??this.view?.queryResults?.getResult(e-1);if(!(this.hass&&this.cameraManager&&i&&this.view&&this.view.queryResults))return;const[t,a]=this._getMediaNeighbors(),r=e=>{const i=this.view?.queryResults?.getSelectedIndex()??null;if(!this.view||!this.view?.queryResults||null===i)return;const t="previous"===e?i-1:i+1;t>=0&&t<this.view.queryResults.getResultsCount()&&this._setViewSelectedIndex(t)},o=this.cameraManager.getCameraMetadata(this.hass,i.getCameraID());return s` <frigate-card-media-carousel
|
||||
${g(this._refMediaCarousel)}
|
||||
.carouselOptions=${S([this.viewerConfig],(()=>({draggable:this.viewerConfig?.draggable??!0})))}
|
||||
.carouselPlugins=${S([this.viewerConfig,this.view.queryResults.getResults()],this._getPlugins.bind(this))}
|
||||
.label=${i.getTitle()??void 0}
|
||||
.logo=${o?.engineLogo}
|
||||
.titlePopupConfig=${this.viewerConfig?.controls.title}
|
||||
.selected=${this.view?.queryResults?.getSelectedIndex()??0}
|
||||
transitionEffect=${this._getTransitionEffect()}
|
||||
@frigate-card:media-carousel:select=${this._setViewHandler.bind(this)}
|
||||
@frigate-card:media:loaded=${this._seekHandler.bind(this)}
|
||||
>
|
||||
<frigate-card-next-previous-control
|
||||
slot="previous"
|
||||
.hass=${this.hass}
|
||||
.direction=${"previous"}
|
||||
.controlConfig=${this.viewerConfig?.controls.next_previous}
|
||||
.thumbnail=${t?.getThumbnail()??void 0}
|
||||
.label=${t?.getTitle()??""}
|
||||
?disabled=${!t}
|
||||
@click=${e=>{r("previous"),f(e)}}
|
||||
></frigate-card-next-previous-control>
|
||||
${S(this.view?.queryResults?.getResults(),(()=>this._getSlides()))}
|
||||
<frigate-card-next-previous-control
|
||||
slot="next"
|
||||
.hass=${this.hass}
|
||||
.direction=${"next"}
|
||||
.controlConfig=${this.viewerConfig?.controls.next_previous}
|
||||
.thumbnail=${a?.getThumbnail()??void 0}
|
||||
.label=${a?.getTitle()??""}
|
||||
?disabled=${!a}
|
||||
@click=${e=>{r("next"),f(e)}}
|
||||
></frigate-card-next-previous-control>
|
||||
</frigate-card-media-carousel>`}async _seekHandler(){const e=this.view?.context?.mediaViewer?.seek,i=this.view?.queryResults?.getSelectedResult();if(!this.hass||!i||!e)return;const t=await(this.cameraManager?.getMediaSeekTime(this.hass,i,e))??null,a=this._getPlayer();a&&null!==t&&a.seek(t)}_renderMediaItem(e,i){return this.hass&&this.view&&this.viewerConfig?s` <div class="embla__slide">
|
||||
<frigate-card-viewer-provider
|
||||
.hass=${this.hass}
|
||||
.view=${this.view}
|
||||
.media=${e}
|
||||
.viewerConfig=${this.viewerConfig}
|
||||
.resolvedMediaCache=${this.resolvedMediaCache}
|
||||
.cameraManager=${this.cameraManager}
|
||||
.disabled=${this.viewerConfig.lazy_load}
|
||||
.cardWideConfig=${this.cardWideConfig}
|
||||
@frigate-card:media:loaded=${e=>{I(i,e)}}
|
||||
></frigate-card-viewer-provider>
|
||||
</div>`:null}static get styles(){return r(".embla__slide {\n height: 100%;\n flex: 0 0 100%;\n}")}};o([d({attribute:!1})],L.prototype,"hass",void 0),o([d({attribute:!1})],L.prototype,"view",void 0),o([d({attribute:!1,hasChanged:p})],L.prototype,"viewerConfig",void 0),o([d({attribute:!1})],L.prototype,"resolvedMediaCache",void 0),o([d({attribute:!1})],L.prototype,"cardWideConfig",void 0),o([d({attribute:!1})],L.prototype,"cameraManager",void 0),L=o([l("frigate-card-viewer-carousel")],L);let U=class extends e{constructor(){super(...arguments),this.disabled=!1,this._refFrigateCardMediaPlayer=n(),this._refVideoProvider=n(),this._refImageProvider=n()}async play(){await T(this,this._refFrigateCardMediaPlayer.value??this._refVideoProvider.value)}async pause(){(this._refFrigateCardMediaPlayer.value||this._refVideoProvider.value)?.pause()}async mute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!0)}async unmute(){this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.mute():this._refVideoProvider.value&&(this._refVideoProvider.value.muted=!1)}isMuted(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value?.isMuted()??!0:!this._refVideoProvider.value||this._refVideoProvider.value.muted}async seek(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.seek(e);this._refVideoProvider.value&&(F(this._refVideoProvider.value),this._refVideoProvider.value.currentTime=e)}async setControls(e){if(this._refFrigateCardMediaPlayer.value)return this._refFrigateCardMediaPlayer.value.setControls(e);this._refVideoProvider.value&&k(this._refVideoProvider.value,e??this.viewerConfig?.controls.builtin??!0)}isPaused(){return this._refFrigateCardMediaPlayer.value?this._refFrigateCardMediaPlayer.value.isPaused():!this._refVideoProvider.value||this._refVideoProvider.value.paused}async getScreenshotURL(){return this._refFrigateCardMediaPlayer.value?await this._refFrigateCardMediaPlayer.value.getScreenshotURL():this._refVideoProvider.value?m(this._refVideoProvider.value):this._refImageProvider.value?this._refImageProvider.value.src:null}async _dispatchRelatedClipView(){if(!(this.hass&&this.view&&this.cameraManager&&this.media&&w.isEvent(this.media)&&y.areEventQueries(this.view.query)))return;const e=this.view.query.clone();e.convertToClipsQueries();const i=e.getQueries();if(!i)return;let t;try{t=await this.cameraManager.executeMediaQueries(this.hass,i)}catch(e){return void C(e)}if(!t)return;const a=new _(t);a.selectResultIfFound((e=>e.getID()===this.media?.getID())),a.hasSelectedResult()&&this.view.evolve({view:"media",query:e,queryResults:a}).dispatchChangeEvent(this)}willUpdate(e){const i=this.media?this.media.getContentID():null;!((e.has("disabled")||e.has("media")||e.has("viewerConfig")||e.has("resolvedMediaCache")||e.has("hass"))&&this.hass&&i)||this.resolvedMediaCache?.has(i)||this.viewerConfig?.lazy_load&&this.disabled||b(this.hass,i,this.resolvedMediaCache).then((()=>{this.requestUpdate()})),e.has("viewerConfig")&&this.viewerConfig?.zoomable&&import("./zoomer-1857311a.js")}_useZoomIfRequired(e){return this.viewerConfig?.zoomable?s` <frigate-card-zoomer
|
||||
@frigate-card:zoom:zoomed=${()=>this.setControls(!1)}
|
||||
@frigate-card:zoom:unzoomed=${()=>this.setControls()}
|
||||
>
|
||||
${e}
|
||||
</frigate-card-zoomer>`:e}render(){if(this.disabled||!this.media||!this.hass||!this.view||!this.viewerConfig)return;const e=this.media.getContentID(),i=e?this.resolvedMediaCache?.get(e):null;return i?this._useZoomIfRequired(s`
|
||||
${w.isVideo(this.media)?this.media.getVideoContentType()===E.HLS?s`<frigate-card-ha-hls-player
|
||||
${g(this._refFrigateCardMediaPlayer)}
|
||||
allow-exoplayer
|
||||
aria-label="${this.media.getTitle()??""}"
|
||||
?autoplay=${!1}
|
||||
controls
|
||||
muted
|
||||
playsinline
|
||||
title="${this.media.getTitle()??""}"
|
||||
url=${$(this.hass,i?.url)??""}
|
||||
.hass=${this.hass}
|
||||
?controls=${this.viewerConfig.controls.builtin}
|
||||
>
|
||||
</frigate-card-ha-hls-player>`:s`
|
||||
<video
|
||||
${g(this._refVideoProvider)}
|
||||
aria-label="${this.media.getTitle()??""}"
|
||||
title="${this.media.getTitle()??""}"
|
||||
muted
|
||||
playsinline
|
||||
crossorigin="anonymous"
|
||||
?autoplay=${!1}
|
||||
?controls=${this.viewerConfig.controls.builtin}
|
||||
@loadedmetadata=${e=>{e.target&&this.viewerConfig?.controls.builtin&&F(e.target,z)}}
|
||||
@loadeddata=${e=>{M(this,e,{player:this,capabilities:{supportsPause:!0,hasAudio:W(e.target)}})}}
|
||||
@volumechange=${()=>P(this)}
|
||||
@play=${()=>R(this)}
|
||||
@pause=${()=>x(this)}
|
||||
>
|
||||
<source
|
||||
src=${$(this.hass,i?.url)??""}
|
||||
type="video/mp4"
|
||||
/>
|
||||
</video>
|
||||
`:s`<img
|
||||
${g(this._refImageProvider)}
|
||||
aria-label="${this.media.getTitle()??""}"
|
||||
src="${$(this.hass,i?.url)??""}"
|
||||
title="${this.media.getTitle()??""}"
|
||||
@click=${()=>{this.viewerConfig?.snapshot_click_plays_clip&&this._dispatchRelatedClipView()}}
|
||||
@load=${e=>{M(this,e,{player:this})}}
|
||||
/>`}
|
||||
`):a({cardWideConfig:this.cardWideConfig})}static get styles(){return r(":host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\nimg,\nvideo,\nfrigate-card-ha-hls-player {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--frigate-card-media-layout-fit, contain);\n object-position: var(--frigate-card-media-layout-position-x, 50%) var(--frigate-card-media-layout-position-y, 50%);\n}\n\nfrigate-card-progress-indicator {\n padding: 30px;\n box-sizing: border-box;\n}")}};o([d({attribute:!1})],U.prototype,"hass",void 0),o([d({attribute:!1})],U.prototype,"view",void 0),o([d({attribute:!1})],U.prototype,"media",void 0),o([d({attribute:!1})],U.prototype,"viewerConfig",void 0),o([d({attribute:!1})],U.prototype,"resolvedMediaCache",void 0),o([d({attribute:!1})],U.prototype,"disabled",void 0),o([d({attribute:!1})],U.prototype,"cameraManager",void 0),o([d({attribute:!1})],U.prototype,"cardWideConfig",void 0),U=o([l(H)],U);export{D as FrigateCardViewer,L as FrigateCardViewerCarousel,U as FrigateCardViewerProvider};
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in New Issue