Fix wait transcoding checkbox display
This commit is contained in:
parent
e08ff02a9f
commit
ddb62a85c5
|
@ -136,7 +136,7 @@
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</my-peertube-checkbox>
|
</my-peertube-checkbox>
|
||||||
|
|
||||||
<my-peertube-checkbox *ngIf="isWaitTranscodingDisplayed()" inputName="waitTranscoding" formControlName="waitTranscoding" helpPlacement="bottom-right">
|
<my-peertube-checkbox *ngIf="waitTranscodingEnabled" inputName="waitTranscoding" formControlName="waitTranscoding" helpPlacement="bottom-right">
|
||||||
<ng-template ptTemplate="label">
|
<ng-template ptTemplate="label">
|
||||||
<ng-container i18n>Publish after transcoding</ng-container>
|
<ng-container i18n>Publish after transcoding</ng-container>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
@ -347,5 +347,5 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<my-video-caption-add-modal
|
<my-video-caption-add-modal
|
||||||
#videoCaptionAddModal [existingCaptions]="existingCaptions" [serverConfig]="serverConfig" (captionAdded)="onCaptionAdded($event)"
|
#videoCaptionAddModal [existingCaptions]="getExistingCaptions()" [serverConfig]="serverConfig" (captionAdded)="onCaptionAdded($event)"
|
||||||
></my-video-caption-add-modal>
|
></my-video-caption-add-modal>
|
||||||
|
|
|
@ -96,22 +96,6 @@ export class VideoEditComponent implements OnInit, OnDestroy {
|
||||||
this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat()
|
this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat()
|
||||||
}
|
}
|
||||||
|
|
||||||
get existingCaptions () {
|
|
||||||
return this.videoCaptions
|
|
||||||
.filter(c => c.action !== 'REMOVE')
|
|
||||||
.map(c => c.language.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
isWaitTranscodingDisplayed () {
|
|
||||||
if (!this.waitTranscodingEnabled) return false
|
|
||||||
|
|
||||||
if (this.liveVideo) {
|
|
||||||
return this.form.value['saveReplay'] === true
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
updateForm () {
|
updateForm () {
|
||||||
const defaultValues: any = {
|
const defaultValues: any = {
|
||||||
nsfw: 'false',
|
nsfw: 'false',
|
||||||
|
@ -217,6 +201,12 @@ export class VideoEditComponent implements OnInit, OnDestroy {
|
||||||
if (this.schedulerInterval) clearInterval(this.schedulerInterval)
|
if (this.schedulerInterval) clearInterval(this.schedulerInterval)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getExistingCaptions () {
|
||||||
|
return this.videoCaptions
|
||||||
|
.filter(c => c.action !== 'REMOVE')
|
||||||
|
.map(c => c.language.id)
|
||||||
|
}
|
||||||
|
|
||||||
onCaptionAdded (caption: VideoCaptionEdit) {
|
onCaptionAdded (caption: VideoCaptionEdit) {
|
||||||
const existingCaption = this.videoCaptions.find(c => c.language.id === caption.language.id)
|
const existingCaption = this.videoCaptions.find(c => c.language.id === caption.language.id)
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<form [hidden]="!isInUpdateForm" novalidate [formGroup]="form">
|
<form [hidden]="!isInUpdateForm" novalidate [formGroup]="form">
|
||||||
<my-video-edit
|
<my-video-edit
|
||||||
[form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
|
[form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
|
||||||
[schedulePublicationPossible]="false" [waitTranscodingEnabled]="false"
|
[schedulePublicationPossible]="false" [waitTranscodingEnabled]="isWaitTranscodingEnabled()"
|
||||||
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [liveVideo]="liveVideo"
|
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [liveVideo]="liveVideo"
|
||||||
type="go-live"
|
type="go-live"
|
||||||
></my-video-edit>
|
></my-video-edit>
|
||||||
|
|
|
@ -137,6 +137,10 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, CanCompon
|
||||||
return this.serverConfig.live.maxDuration / 1000
|
return this.serverConfig.live.maxDuration / 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isWaitTranscodingEnabled () {
|
||||||
|
return this.form.value['saveReplay'] === true
|
||||||
|
}
|
||||||
|
|
||||||
private fetchVideoLive () {
|
private fetchVideoLive () {
|
||||||
this.liveVideoService.getVideoLive(this.videoId)
|
this.liveVideoService.getVideoLive(this.videoId)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
<my-video-edit
|
<my-video-edit
|
||||||
[form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
|
[form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
|
||||||
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
|
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
|
||||||
[waitTranscodingEnabled]="waitTranscodingEnabled"
|
[waitTranscodingEnabled]="true"
|
||||||
type="upload"
|
type="upload"
|
||||||
></my-video-edit>
|
></my-video-edit>
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
|
||||||
}
|
}
|
||||||
formData: FormData
|
formData: FormData
|
||||||
|
|
||||||
waitTranscodingEnabled = true
|
|
||||||
previewfileUpload: File
|
previewfileUpload: File
|
||||||
|
|
||||||
error: string
|
error: string
|
||||||
|
@ -163,11 +162,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
|
||||||
if (nameWithoutExtension.length < 3) name = videofile.name
|
if (nameWithoutExtension.length < 3) name = videofile.name
|
||||||
else name = nameWithoutExtension
|
else name = nameWithoutExtension
|
||||||
|
|
||||||
// Force user to wait transcoding for unsupported video types in web browsers
|
|
||||||
if (!videofile.name.endsWith('.mp4') && !videofile.name.endsWith('.webm') && !videofile.name.endsWith('.ogv')) {
|
|
||||||
this.waitTranscodingEnabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
const nsfw = this.serverConfig.instance.isNSFW
|
const nsfw = this.serverConfig.instance.isNSFW
|
||||||
const waitTranscoding = true
|
const waitTranscoding = true
|
||||||
const commentsEnabled = true
|
const commentsEnabled = true
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<my-video-edit
|
<my-video-edit
|
||||||
[form]="form" [formErrors]="formErrors" [schedulePublicationPossible]="schedulePublicationPossible"
|
[form]="form" [formErrors]="formErrors" [schedulePublicationPossible]="schedulePublicationPossible"
|
||||||
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
|
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
|
||||||
[videoCaptions]="videoCaptions" [waitTranscodingEnabled]="waitTranscodingEnabled"
|
[videoCaptions]="videoCaptions" [waitTranscodingEnabled]="isWaitTranscodingEnabled()"
|
||||||
type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()"
|
type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()"
|
||||||
[liveVideo]="liveVideo"
|
[liveVideo]="liveVideo"
|
||||||
></my-video-edit>
|
></my-video-edit>
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { hydrateFormFromVideo } from './shared/video-edit-utils'
|
||||||
})
|
})
|
||||||
export class VideoUpdateComponent extends FormReactive implements OnInit {
|
export class VideoUpdateComponent extends FormReactive implements OnInit {
|
||||||
video: VideoEdit
|
video: VideoEdit
|
||||||
|
videoDetails: VideoDetails
|
||||||
userVideoChannels: SelectChannelItem[] = []
|
userVideoChannels: SelectChannelItem[] = []
|
||||||
videoCaptions: VideoCaptionEdit[] = []
|
videoCaptions: VideoCaptionEdit[] = []
|
||||||
liveVideo: LiveVideo
|
liveVideo: LiveVideo
|
||||||
|
@ -47,17 +48,14 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
|
||||||
.pipe(map(data => data.videoData))
|
.pipe(map(data => data.videoData))
|
||||||
.subscribe(({ video, videoChannels, videoCaptions, liveVideo }) => {
|
.subscribe(({ video, videoChannels, videoCaptions, liveVideo }) => {
|
||||||
this.video = new VideoEdit(video)
|
this.video = new VideoEdit(video)
|
||||||
|
this.videoDetails = video
|
||||||
|
|
||||||
this.userVideoChannels = videoChannels
|
this.userVideoChannels = videoChannels
|
||||||
this.videoCaptions = videoCaptions
|
this.videoCaptions = videoCaptions
|
||||||
this.liveVideo = liveVideo
|
this.liveVideo = liveVideo
|
||||||
|
|
||||||
this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE
|
this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE
|
||||||
|
|
||||||
const videoFiles = (video as VideoDetails).getFiles()
|
|
||||||
if (videoFiles.length > 1) { // Already transcoded
|
|
||||||
this.waitTranscodingEnabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout
|
// FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
hydrateFormFromVideo(this.form, this.video, true)
|
hydrateFormFromVideo(this.form, this.video, true)
|
||||||
|
@ -106,6 +104,18 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
|
||||||
return this.form.valid
|
return this.form.valid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isWaitTranscodingEnabled () {
|
||||||
|
if (this.videoDetails.getFiles().length > 1) { // Already transcoded
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.liveVideo && this.form.value['saveReplay'] !== true) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
update () {
|
update () {
|
||||||
if (this.checkForm() === false
|
if (this.checkForm() === false
|
||||||
|| this.isUpdatingVideo === true) {
|
|| this.isUpdatingVideo === true) {
|
||||||
|
|
Loading…
Reference in New Issue