1 import { finalize } from 'rxjs/operators'
2 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
3 import { AuthService, Notifier } from '@app/core'
4 import { Video, VideoService } from '../../shared-main'
5 import { MiniatureDisplayOptions } from '../../shared-video-miniature'
6 import { CustomMarkupComponent } from './shared'
9 * Markup component that creates a video miniature only
13 selector: 'my-video-miniature-markup',
14 templateUrl: 'video-miniature-markup.component.html',
15 styleUrls: [ 'video-miniature-markup.component.scss' ]
17 export class VideoMiniatureMarkupComponent implements CustomMarkupComponent, OnInit {
19 @Input() onlyDisplayTitle: boolean
21 @Output() loaded = new EventEmitter<boolean>()
25 displayOptions: MiniatureDisplayOptions = {
37 private auth: AuthService,
38 private videoService: VideoService,
39 private notifier: Notifier
43 return this.auth.getUser()
47 if (this.onlyDisplayTitle) {
48 for (const key of Object.keys(this.displayOptions)) {
49 this.displayOptions[key] = false
53 this.videoService.getVideo({ videoId: this.uuid })
54 .pipe(finalize(() => this.loaded.emit(true)))
56 video => this.video = video,
58 err => this.notifier.error('Error in video miniature component: ' + err.message)