Files @ 157985a971dc
Branch filter:

Location: light9/light9/web/light9-vidref-live.js

drewp@bigasterisk.com
non-working WIP for vidref web
Ignore-this: e4be7b5961222bedb5ffe53c46388b3
import { LitElement, TemplateResult, html, css } from '/node_modules/lit-element/lit-element.js';
import { debug } from '/lib/debug/debug-build-es6.js';
debug.enable('*');
log = debug('live')

class Light9VidrefLive extends LitElement {
    
    static get properties() {
        return {
            description: { type: String }
        };
    }

    static get styles() {
        return css`
        :host {
            border: 2px solid #46a79f;
            display: inline-block;
        }
        `;
    }

    firstUpdated() {
        const ws = reconnectingWebSocket('live', (msg) => {
            this.shadowRoot.querySelector('#live').src = 'data:image/jpeg;base64,' + msg.jpeg;
            this.description = msg.description;
        });
        
    }

    disconnectedCallback() {
        log('bye');
        
    }
    
    render() {
        return html`
<div>
<div><img id="live" ></div>
<div>${this.description}</div>
</div>
`;

    }
}
customElements.define('light9-vidref-live', Light9VidrefLive);