aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video/video-thumbnail.component.ts
blob: e52f7dfb0824f2da18389a7a73a49d6a961c5a6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { Component, Input } from '@angular/core'
import { isInMobileView } from '@app/shared/misc/utils'
import { Video } from './video.model'

@Component({
  selector: 'my-video-thumbnail',
  styleUrls: [ './video-thumbnail.component.scss' ],
  templateUrl: './video-thumbnail.component.html'
})
export class VideoThumbnailComponent {
  @Input() video: Video
  @Input() nsfw = false

  getImageUrl () {
    if (!this.video) return ''

    if (isInMobileView()) {
      return this.video.previewUrl
    }

    return this.video.thumbnailUrl
  }
}