]>
Commit | Line | Data |
---|---|---|
202f6b6c C |
1 | import { Component, Input } from '@angular/core' |
2 | import { Video } from './video.model' | |
bbe0f064 | 3 | import { ScreenService } from '@app/shared/misc/screen.service' |
202f6b6c C |
4 | |
5 | @Component({ | |
6 | selector: 'my-video-thumbnail', | |
7 | styleUrls: [ './video-thumbnail.component.scss' ], | |
8 | templateUrl: './video-thumbnail.component.html' | |
9 | }) | |
10 | export class VideoThumbnailComponent { | |
11 | @Input() video: Video | |
12 | @Input() nsfw = false | |
3290f37c | 13 | |
bbe0f064 C |
14 | constructor (private screenService: ScreenService) {} |
15 | ||
3290f37c C |
16 | getImageUrl () { |
17 | if (!this.video) return '' | |
18 | ||
bbe0f064 | 19 | if (this.screenService.isInMobileView()) { |
3290f37c C |
20 | return this.video.previewUrl |
21 | } | |
22 | ||
23 | return this.video.thumbnailUrl | |
24 | } | |
202f6b6c | 25 | } |