Don't select a frame from a live

This commit is contained in:
Chocobozzz 2024-10-22 09:50:26 +02:00
parent b02f1aec30
commit 6425223b2a
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 7 additions and 3 deletions

View File

@ -27,7 +27,7 @@
[buttonTooltip]="getReactiveFileButtonTooltip()"> [buttonTooltip]="getReactiveFileButtonTooltip()">
</my-reactive-file> </my-reactive-file>
@if (video) { @if (canSelectFromVideo()) {
<button i18n type="button" class="peertube-button grey-button ms-2" (click)="selectFromVideo()">Select from video</button> <button i18n type="button" class="peertube-button grey-button ms-2" (click)="selectFromVideo()">Select from video</button>
} }
} }

View File

@ -13,7 +13,7 @@ import {
import { ReactiveFileComponent } from '@app/shared/shared-forms/reactive-file.component' import { ReactiveFileComponent } from '@app/shared/shared-forms/reactive-file.component'
import { BytesPipe } from '@app/shared/shared-main/angular/bytes.pipe' import { BytesPipe } from '@app/shared/shared-main/angular/bytes.pipe'
import { EmbedComponent, EmbedVideoInput } from '@app/shared/shared-main/video/embed.component' import { EmbedComponent, EmbedVideoInput } from '@app/shared/shared-main/video/embed.component'
import { HTMLServerConfig } from '@peertube/peertube-models' import { HTMLServerConfig, Video, VideoState } from '@peertube/peertube-models'
import { imageToDataURL } from '@root-helpers/images' import { imageToDataURL } from '@root-helpers/images'
import { PeerTubePlayer } from '../../../../../standalone/embed-player-api/player' import { PeerTubePlayer } from '../../../../../standalone/embed-player-api/player'
@ -34,7 +34,7 @@ import { PeerTubePlayer } from '../../../../../standalone/embed-player-api/playe
export class ThumbnailManagerComponent implements OnInit, ControlValueAccessor { export class ThumbnailManagerComponent implements OnInit, ControlValueAccessor {
@ViewChild('embed') embed: EmbedComponent @ViewChild('embed') embed: EmbedComponent
@Input() video: EmbedVideoInput @Input() video: EmbedVideoInput & Pick<Video, 'isLive' | 'state'>
imageSrc: string imageSrc: string
allowedExtensionsMessage = '' allowedExtensionsMessage = ''
@ -71,6 +71,10 @@ export class ThumbnailManagerComponent implements OnInit, ControlValueAccessor {
return this.bytesPipe.transform(this.maxVideoImageSize) return this.bytesPipe.transform(this.maxVideoImageSize)
} }
canSelectFromVideo () {
return this.video && !this.video.isLive && this.video.state.id === VideoState.PUBLISHED
}
getReactiveFileButtonTooltip () { getReactiveFileButtonTooltip () {
return $localize`(extensions: ${this.videoImageExtensions}, ${this.maxSizeText}\: ${this.maxVideoImageSizeInBytes})` return $localize`(extensions: ${this.videoImageExtensions}, ${this.maxSizeText}\: ${this.maxVideoImageSizeInBytes})`
} }