1 import videojs from 'video.js'
3 const Component = videojs.getComponent('Component')
5 export type PeerTubeDockComponentOptions = {
11 class PeerTubeDockComponent extends Component {
14 const options = this.options_ as PeerTubeDockComponentOptions
16 const el = super.createEl('div', {
17 className: 'peertube-dock'
20 if (options.avatarUrl) {
21 const avatar = videojs.dom.createEl('img', {
22 className: 'peertube-dock-avatar',
23 src: options.avatarUrl
26 el.appendChild(avatar)
29 const elWrapperTitleDescription = super.createEl('div', {
30 className: 'peertube-dock-title-description'
34 const title = videojs.dom.createEl('div', {
35 className: 'peertube-dock-title',
37 innerHTML: options.title
40 elWrapperTitleDescription.appendChild(title)
43 if (options.description) {
44 const description = videojs.dom.createEl('div', {
45 className: 'peertube-dock-description',
46 title: options.description,
47 innerHTML: options.description
50 elWrapperTitleDescription.appendChild(description)
53 if (options.title || options.description) {
54 el.appendChild(elWrapperTitleDescription)
61 videojs.registerComponent('PeerTubeDockComponent', PeerTubeDockComponent)