X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fvideo%2Fvideo-thumbnail.component.ts;h=86d8f6f742163f91fd8c1a486a7797162feeb2aa;hb=99492dbc0d87ef54d0dab7d8d44f8d0de5722bdd;hp=e543e9903bbf1855bc7e5d820b07f1f699634c30;hpb=202f6b6c9dcc9b0aec4b0c1b15e455c22a7952a7;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/video/video-thumbnail.component.ts b/client/src/app/shared/video/video-thumbnail.component.ts index e543e9903..86d8f6f74 100644 --- a/client/src/app/shared/video/video-thumbnail.component.ts +++ b/client/src/app/shared/video/video-thumbnail.component.ts @@ -1,5 +1,6 @@ import { Component, Input } from '@angular/core' import { Video } from './video.model' +import { ScreenService } from '@app/shared/misc/screen.service' @Component({ selector: 'my-video-thumbnail', @@ -9,4 +10,16 @@ import { Video } from './video.model' export class VideoThumbnailComponent { @Input() video: Video @Input() nsfw = false + + constructor (private screenService: ScreenService) {} + + getImageUrl () { + if (!this.video) return '' + + if (this.screenService.isInMobileView()) { + return this.video.previewUrl + } + + return this.video.thumbnailUrl + } }