Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions custom_components/webrtc/www/webrtc-camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,34 @@ class WebRTCCamera extends VideoRTC {
const mode = this.querySelector('.mode');
mode.addEventListener('click', () => this.nextStream(true));

const player = this.querySelector('.player');

// Tap action
player.addEventListener('click', e => {
if (this.config.tap_action && this.config.tap_action.action) {
this.handleAction("tap", this.config);
e.preventDefault();
}
});

if (this.config.muted) this.video.muted = true;
if (this.config.poster_remote) this.video.poster = this.config.poster;
}

handleAction(action, config) {
const event = new Event("hass-action", {
bubbles: true,
composed: true,
});

event.detail = {
config: config,
action: action
}

this.dispatchEvent(event);
}

renderDigitalPTZ() {
if (this.config.digital_ptz === false) return;
new DigitalPTZ(
Expand Down