class WebRTCStreamerFooterElement extends HTMLElement { constructor() { super(); this.shadowDOM = this.attachShadow({mode: 'open'}); this.shadowDOM.innerHTML = ` `; } static get observedAttributes() { return ['webrtcurl']; } attributeChangedCallback(attrName, oldVal, newVal) { if (attrName === "webrtcurl") { this.fillFooter(); } } connectedCallback() { this.fillFooter(); } fillFooter() { let footerElement = this.shadowDOM.getElementById("footer"); const webrtcurl = this.getAttribute("webrtcurl") || ""; fetch(webrtcurl + "/api/version").then(r => r.text()).then( function (response) { footerElement.innerHTML = "
WebRTC-Streamer " + response.split(" ")[0] + "
"; }); } } customElements.define('webrtc-streamer-footer', WebRTCStreamerFooterElement);