component.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { LitElement, html, css } from 'lit'
  2. /**
  3. * Block Media Player
  4. */
  5. export class BlockMediaPlayerElement extends LitElement {
  6. static get styles() {
  7. return css`
  8. :host {
  9. display: block;
  10. }
  11. .container {
  12. overflow: hidden;
  13. border-radius: 5px;
  14. position: relative;
  15. }
  16. `
  17. }
  18. static get properties() {
  19. return {
  20. /**
  21. * Source URL
  22. * @type {string}
  23. */
  24. src: { type: String },
  25. // Internal Properties
  26. // _loading: { state: true }
  27. }
  28. }
  29. constructor() {
  30. super()
  31. }
  32. async connectedCallback() {
  33. super.connectedCallback()
  34. }
  35. // get _video() {
  36. // return this.renderRoot?.querySelector('.video-display') ?? null
  37. // }
  38. // _playPause () {
  39. // if (this._video.paused) {
  40. // this._video.play()
  41. // } else {
  42. // this._video.pause()
  43. // }
  44. // }
  45. // _fullScreen () {
  46. // if (this._video.requestFullscreen) {
  47. // this._video.requestFullscreen()
  48. // } else if (this._video.webkitRequestFullscreen) {
  49. // this._video.webkitRequestFullscreen()
  50. // }
  51. // }
  52. render() {
  53. return html`
  54. <div class="container">
  55. <video class="video-display" controls>
  56. <source src="${this.src}" type="video/mp4">
  57. </video>
  58. </div>
  59. `
  60. }
  61. }
  62. window.customElements.define('block-media-player', BlockMediaPlayerElement)