blob: ca43700c7c7d620eba0ce29fe3034564569eb714 (
plain) (
tree)
|
|
import { Component, Input } from '@angular/core'
import { Video } from './video.model'
import { ScreenService } from '@app/shared/misc/screen.service'
@Component({
selector: 'my-video-thumbnail',
styleUrls: [ './video-thumbnail.component.scss' ],
templateUrl: './video-thumbnail.component.html'
})
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
}
getProgressPercent () {
if (!this.video.userHistory) return 0
const currentTime = this.video.userHistory.currentTime
return (currentTime / this.video.duration) * 100
}
}
|