Skip to content

How can I use the <media-theme> element? #796

Answered by endymion1818
endymion1818 asked this question in Q&A
Discussion options

You must be logged in to vote

For anyone else searching for this, the solution is to define a template, importing MediaThemeElement from media-chrome

import { MediaThemeElement } from "media-chrome/dist/media-theme-element";

const template = document.createElement("template");

template.innerHTML = `
    <media-controller>
    <slot name="media" slot="media"></slot>
    <media-control-bar>
        <media-play-button></media-play-button>
    </media-control-bar>
        {{username ?? 'Unknown user'}}
    </media-controller>
`;

class TinyTheme extends MediaThemeElement {
  static template = template;
}

if (!globalThis.customElements.get("tiny-theme")) {
  globalThis.customElements.define("tiny-theme", TinyTheme);
}

…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@endymion1818
Comment options

@endymion1818
Comment options

@endymion1818
Comment options

Answer selected by endymion1818
@luwes
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #794 on January 31, 2024 17:18.