></my-peertube-checkbox>
</div>
+ <div class="form-group">
+ <my-peertube-checkbox
+ inputName="embedP2P" [(ngModel)]="customizations.embedP2P"
+ i18n-labelText labelText="P2P"
+ ></my-peertube-checkbox>
+ </div>
+
<div class="form-group">
<my-peertube-checkbox
inputName="warningTitle" [(ngModel)]="customizations.warningTitle"
- i18n-labelText labelText="Display privacy warning"
+ i18n-labelText labelText="Display privacy warning" [disabled]="!customizations.embedP2P"
></my-peertube-checkbox>
</div>
<div class="form-group">
<my-peertube-checkbox
- inputName="controls" [(ngModel)]="customizations.peertubeLink"
+ inputName="peertubeLink" [(ngModel)]="customizations.peertubeLink"
i18n-labelText labelText="Display PeerTube button link"
></my-peertube-checkbox>
</div>
import { Component, ElementRef, Input, ViewChild } from '@angular/core'
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
+import { ServerService } from '@app/core'
import { VideoDetails } from '@app/shared/shared-main'
import { VideoPlaylist } from '@app/shared/shared-video-playlist'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
originUrl: boolean
autoplay: boolean
muted: boolean
+
+ embedP2P: boolean
title: boolean
warningTitle: boolean
controls: boolean
constructor (
private modalService: NgbModal,
- private sanitizer: DomSanitizer
+ private sanitizer: DomSanitizer,
+ private server: ServerService
) { }
show (currentVideoTimestamp?: number, currentPlaylistPosition?: number) {
autoplay: false,
muted: false,
+ embedP2P: this.server.getHTMLConfig().defaults.p2p.embed.enabled,
+
// Embed options
title: true,
warningTitle: true,
set: (target, prop, value) => {
target[prop] = value
+ if (prop === 'embedP2P') {
+ // Auto enabled warning title if P2P is enabled
+ this.customizations.warningTitle = value
+ }
+
this.updateEmbedCode()
return true
}
getVideoIframeCode () {
- const embedUrl = decorateVideoLink({ url: this.video.embedUrl, ...this.getVideoOptions() })
+ const embedUrl = decorateVideoLink({ url: this.video.embedUrl, ...this.getVideoOptions(true) })
return buildVideoOrPlaylistEmbed(embedUrl, this.video.name)
}
return decorateVideoLink({
url,
- ...this.getVideoOptions()
+ ...this.getVideoOptions(false)
})
}
}
}
- private getVideoOptions () {
+ private getVideoOptions (forEmbed: boolean) {
+ const embedOptions = forEmbed
+ ? {
+ title: this.customizations.title,
+ warningTitle: this.customizations.warningTitle,
+ controls: this.customizations.controls,
+ peertubeLink: this.customizations.peertubeLink,
+
+ // If using default value, we don't need to specify it
+ p2p: this.customizations.embedP2P === this.server.getHTMLConfig().defaults.p2p.embed.enabled
+ ? undefined
+ : this.customizations.embedP2P
+ }
+ : {}
+
return {
startTime: this.customizations.startAtCheckbox ? this.customizations.startAt : undefined,
stopTime: this.customizations.stopAtCheckbox ? this.customizations.stopAt : undefined,
autoplay: this.customizations.autoplay,
muted: this.customizations.muted,
- title: this.customizations.title,
- warningTitle: this.customizations.warningTitle,
- controls: this.customizations.controls,
- peertubeLink: this.customizations.peertubeLink
+ ...embedOptions
}
}
}
title: boolean
warningTitle: boolean
peertubeLink: boolean
+ p2pEnabled: boolean
bigPlayBackgroundColor: string
foregroundColor: string
this.enableApi = this.getParamToggle(params, 'api', this.enableApi)
this.warningTitle = this.getParamToggle(params, 'warningTitle', true)
this.peertubeLink = this.getParamToggle(params, 'peertubeLink', true)
+ this.p2pEnabled = this.getParamToggle(params, 'p2p', this.isP2PEnabled(video))
this.scope = this.getParamString(params, 'scope', this.scope)
this.subtitle = this.getParamString(params, 'subtitle')
muted: this.muted,
loop: this.loop,
- p2pEnabled: this.isP2PEnabled(videoInfo),
+ p2pEnabled: this.p2pEnabled,
captions: videoCaptions.length !== 0,
subtitle: this.subtitle,
const title = this.title ? videoInfo.name : undefined
- const description = this.warningTitle && this.isP2PEnabled(videoInfo)
+ const description = this.warningTitle && this.p2pEnabled
? '<span class="text">' + peertubeTranslate('Watching this video may reveal your IP address to others.') + '</span>'
: undefined