1 import { Component, Input } from '@angular/core'
2 import { Video } from './video.model'
3 import { ScreenService } from '@app/shared/misc/screen.service'
6 selector: 'my-video-thumbnail',
7 styleUrls: [ './video-thumbnail.component.scss' ],
8 templateUrl: './video-thumbnail.component.html'
10 export class VideoThumbnailComponent {
13 @Input() routerLink: any[]
14 @Input() queryParams: any[]
16 constructor (private screenService: ScreenService) {
20 if (!this.video) return ''
22 if (this.screenService.isInMobileView()) {
23 return this.video.previewUrl
26 return this.video.thumbnailUrl
29 getProgressPercent () {
30 if (!this.video.userHistory) return 0
32 const currentTime = this.video.userHistory.currentTime
34 return (currentTime / this.video.duration) * 100
37 getVideoRouterLink () {
38 if (this.routerLink) return this.routerLink
40 return [ '/videos/watch', this.video.uuid ]