mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-09-11 21:47:09 +03:00
Use my-embed component
This commit is contained in:
parent
58f156e748
commit
4a67994775
@ -1,41 +1,37 @@
|
|||||||
<div class="root">
|
<div class="root">
|
||||||
|
|
||||||
<div id="embedContainer" class="" style="position: relative;"></div>
|
@if (video && selectingFromVideo) {
|
||||||
|
<my-embed #embed [video]="video" enableAPI="true" mute="true" autoplay="true"></my-embed>
|
||||||
@if (!selectingFromVideo) {
|
} @else {
|
||||||
|
|
||||||
<div class="preview-container">
|
<div class="preview-container">
|
||||||
|
|
||||||
@if (imageSrc) {
|
@if (imageSrc) {
|
||||||
<img [ngStyle]="{ width: previewWidth, height: previewHeight }" [src]="imageSrc" class="preview" alt="Preview" i18n-alt />
|
<img [src]="imageSrc" class="preview" alt="Preview" i18n-alt />
|
||||||
}
|
} @else {
|
||||||
@else {
|
|
||||||
<div class="preview no-image"></div>
|
<div class="preview no-image"></div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="inputs">
|
<div class="mt-2">
|
||||||
|
|
||||||
@if (selectingFromVideo) {
|
@if (selectingFromVideo) {
|
||||||
|
<button i18n type="button" class="peertube-button orange-button me-2" (click)="selectFrame()">Use this frame</button>
|
||||||
|
|
||||||
<input type="button" i18n class="peertube-button orange-button" (click)="selectFrame()" value="Use frame" />
|
<button i18n type="button" i18n class="peertube-button grey-button" (click)="resetSelectFromVideo()">Cancel</button>
|
||||||
|
|
||||||
<input type="button" i18n class="peertube-button grey-button" (click)="resetSelectFromVideo()" value="Cancel" />
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@else {
|
@else {
|
||||||
|
<my-reactive-file
|
||||||
<my-reactive-file inputName="uploadNewThumbnail" inputLabel="Upload image" [extensions]="videoImageExtensions"
|
class="d-inline-block"
|
||||||
[maxFileSize]="maxVideoImageSize" placement="right" icon="upload" (fileChanged)="onFileChanged($event)"
|
inputName="uploadNewThumbnail" inputLabel="Select from your device" [extensions]="videoImageExtensions"
|
||||||
|
[maxFileSize]="maxVideoImageSize" placement="right" (fileChanged)="onFileChanged($event)"
|
||||||
[buttonTooltip]="getReactiveFileButtonTooltip()">
|
[buttonTooltip]="getReactiveFileButtonTooltip()">
|
||||||
</my-reactive-file>
|
</my-reactive-file>
|
||||||
|
|
||||||
<input type="button" i18n class="peertube-button grey-button" (click)="selectFromVideo()"
|
@if (video) {
|
||||||
value="Select from video" />
|
<button i18n type="button" class="peertube-button grey-button ms-2" (click)="selectFromVideo()">Select from video</button>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,50 +5,27 @@
|
|||||||
height: auto;
|
height: auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
.preview-container {
|
.preview-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.preview {
|
.preview {
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
max-width: 100%;
|
|
||||||
|
|
||||||
&.no-image {
|
&.no-image {
|
||||||
border: 2px solid #808080;
|
border: 2px solid #808080;
|
||||||
background-color: pvar(--mainBackgroundColor);
|
background-color: pvar(--mainBackgroundColor);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.inputs {
|
.preview,
|
||||||
|
my-embed {
|
||||||
|
max-width: 500px;
|
||||||
|
width: 500px;
|
||||||
|
|
||||||
margin-top: 10px;
|
max-height: 280px;
|
||||||
|
height: 280px;
|
||||||
my-reactive-file {
|
}
|
||||||
display: inline-block;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
display: inline-block;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.video-embed {
|
|
||||||
|
|
||||||
$video-default-height: 40vh;
|
|
||||||
|
|
||||||
--player-height: #{$video-default-height};
|
|
||||||
// Default player ratio, redefined by the player to automatically adapt player size
|
|
||||||
--player-ratio: #{math.div(16, 9)};
|
|
||||||
|
|
||||||
width: 100%;
|
|
||||||
height: var(--player-height);
|
|
||||||
|
|
||||||
// Can be recalculated by the player depending on video ratio
|
|
||||||
max-width: calc(var(--player-height) * var(--player-ratio));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
|
|
||||||
import { CommonModule } from '@angular/common'
|
import { CommonModule } from '@angular/common'
|
||||||
import { imageToDataURL } from '@root-helpers/images'
|
|
||||||
import { BytesPipe } from '@app/shared/shared-main/angular/bytes.pipe'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
forwardRef,
|
|
||||||
Input,
|
Input,
|
||||||
OnInit
|
OnInit,
|
||||||
|
ViewChild,
|
||||||
|
forwardRef
|
||||||
} from '@angular/core'
|
} from '@angular/core'
|
||||||
|
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
|
||||||
import {
|
import {
|
||||||
ServerService
|
ServerService
|
||||||
} from '@app/core'
|
} from '@app/core'
|
||||||
import { HTMLServerConfig } from '@peertube/peertube-models'
|
|
||||||
import { ReactiveFileComponent } from '@app/shared/shared-forms/reactive-file.component'
|
import { ReactiveFileComponent } from '@app/shared/shared-forms/reactive-file.component'
|
||||||
import { PeerTubePlayer } from 'src/standalone/embed-player-api/player'
|
import { BytesPipe } from '@app/shared/shared-main/angular/bytes.pipe'
|
||||||
import { getAbsoluteAPIUrl } from '@app/helpers'
|
import { EmbedComponent, EmbedVideoInput } from '@app/shared/shared-main/video/embed.component'
|
||||||
|
import { HTMLServerConfig } from '@peertube/peertube-models'
|
||||||
|
import { imageToDataURL } from '@root-helpers/images'
|
||||||
|
import { PeerTubePlayer } from '../../../../../standalone/embed-player-api/player'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-thumbnail-manager',
|
selector: 'my-thumbnail-manager',
|
||||||
styleUrls: [ './thumbnail-manager.component.scss' ],
|
styleUrls: [ './thumbnail-manager.component.scss' ],
|
||||||
templateUrl: './thumbnail-manager.component.html',
|
templateUrl: './thumbnail-manager.component.html',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [ CommonModule, ReactiveFileComponent ],
|
imports: [ CommonModule, ReactiveFileComponent, EmbedComponent ],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: NG_VALUE_ACCESSOR,
|
provide: NG_VALUE_ACCESSOR,
|
||||||
@ -32,11 +32,9 @@ import { getAbsoluteAPIUrl } from '@app/helpers'
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ThumbnailManagerComponent implements OnInit, ControlValueAccessor {
|
export class ThumbnailManagerComponent implements OnInit, ControlValueAccessor {
|
||||||
|
@ViewChild('embed') embed: EmbedComponent
|
||||||
|
|
||||||
@Input() uuid: string
|
@Input() video: EmbedVideoInput
|
||||||
|
|
||||||
previewWidth = '360px'
|
|
||||||
previewHeight = '200px'
|
|
||||||
|
|
||||||
imageSrc: string
|
imageSrc: string
|
||||||
allowedExtensionsMessage = ''
|
allowedExtensionsMessage = ''
|
||||||
@ -46,7 +44,6 @@ export class ThumbnailManagerComponent implements OnInit, ControlValueAccessor {
|
|||||||
bytesPipe: BytesPipe
|
bytesPipe: BytesPipe
|
||||||
imageFile: Blob
|
imageFile: Blob
|
||||||
|
|
||||||
// State Toggle (Upload, Select Frame)
|
|
||||||
selectingFromVideo = false
|
selectingFromVideo = false
|
||||||
|
|
||||||
player: PeerTubePlayer
|
player: PeerTubePlayer
|
||||||
@ -58,7 +55,10 @@ export class ThumbnailManagerComponent implements OnInit, ControlValueAccessor {
|
|||||||
this.maxSizeText = $localize`max size`
|
this.maxSizeText = $localize`max size`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Section - Upload
|
// ---------------------------------------------------------------------------
|
||||||
|
// Upload
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
get videoImageExtensions () {
|
get videoImageExtensions () {
|
||||||
return this.serverConfig.video.image.extensions
|
return this.serverConfig.video.image.extensions
|
||||||
}
|
}
|
||||||
@ -108,44 +108,29 @@ export class ThumbnailManagerComponent implements OnInit, ControlValueAccessor {
|
|||||||
imageToDataURL(this.imageFile).then(result => this.imageSrc = result)
|
imageToDataURL(this.imageFile).then(result => this.imageSrc = result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End Section - Upload
|
|
||||||
|
|
||||||
// Section - Select From Frame
|
// ---------------------------------------------------------------------------
|
||||||
|
// Select from frame
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
selectFromVideo () {
|
selectFromVideo () {
|
||||||
|
|
||||||
this.selectingFromVideo = true
|
this.selectingFromVideo = true
|
||||||
|
|
||||||
const url = getAbsoluteAPIUrl()
|
setTimeout(() => {
|
||||||
|
this.player = new PeerTubePlayer(this.embed.getIframe())
|
||||||
const iframe = document.createElement('iframe')
|
})
|
||||||
iframe.src = `${url}/videos/embed/${this.uuid}?api=1&waitPasswordFromEmbedAPI=1&muted=1&title=0&peertubeLink=0`
|
|
||||||
|
|
||||||
iframe.sandbox.add('allow-same-origin', 'allow-scripts', 'allow-popups')
|
|
||||||
|
|
||||||
iframe.height = '100%'
|
|
||||||
iframe.width = '100%'
|
|
||||||
|
|
||||||
const mainElement = document.querySelector('#embedContainer')
|
|
||||||
mainElement.appendChild(iframe)
|
|
||||||
|
|
||||||
mainElement.classList.add('video-embed')
|
|
||||||
|
|
||||||
this.player = new PeerTubePlayer(iframe)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetSelectFromVideo () {
|
resetSelectFromVideo () {
|
||||||
|
if (this.player) {
|
||||||
if (this.player) this.player.destroy()
|
this.player.destroy()
|
||||||
|
this.player = undefined
|
||||||
const mainElement = document.querySelector('#embedContainer')
|
}
|
||||||
|
|
||||||
mainElement.classList.remove('video-embed')
|
|
||||||
|
|
||||||
this.selectingFromVideo = false
|
this.selectingFromVideo = false
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectFrame () {
|
async selectFrame () {
|
||||||
|
|
||||||
const dataUrl: string = await this.player.getImageDataUrl()
|
const dataUrl: string = await this.player.getImageDataUrl()
|
||||||
|
|
||||||
// Checking for an empty data URL
|
// Checking for an empty data URL
|
||||||
@ -157,42 +142,28 @@ export class ThumbnailManagerComponent implements OnInit, ControlValueAccessor {
|
|||||||
|
|
||||||
const blob: Blob = this.dataURItoBlob(dataUrl)
|
const blob: Blob = this.dataURItoBlob(dataUrl)
|
||||||
|
|
||||||
const file = new File([ blob ], 'PreviewFile.jpg', { type: 'image/jpeg' })
|
const file = new File([ blob ], 'preview-file-from-frame.jpg', { type: 'image/jpeg' })
|
||||||
|
|
||||||
this.imageFile = file
|
this.imageFile = file
|
||||||
|
|
||||||
this.propagateChange(this.imageFile)
|
this.propagateChange(this.imageFile)
|
||||||
|
|
||||||
this.resetSelectFromVideo()
|
this.resetSelectFromVideo()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Credit: https://stackoverflow.com/a/7261048/1030669
|
||||||
* Credit: https://stackoverflow.com/a/7261048/1030669
|
|
||||||
*/
|
|
||||||
dataURItoBlob (dataURI: string) {
|
dataURItoBlob (dataURI: string) {
|
||||||
// convert base64 to raw binary data held in a string
|
|
||||||
// doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
|
|
||||||
const byteString = atob(dataURI.split(',')[1])
|
const byteString = atob(dataURI.split(',')[1])
|
||||||
|
|
||||||
// separate out the mime component
|
|
||||||
const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]
|
const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]
|
||||||
|
|
||||||
// write the bytes of the string to an ArrayBuffer
|
|
||||||
const ab = new ArrayBuffer(byteString.length)
|
const ab = new ArrayBuffer(byteString.length)
|
||||||
|
|
||||||
// create a view into the buffer
|
|
||||||
const ia = new Uint8Array(ab)
|
const ia = new Uint8Array(ab)
|
||||||
|
|
||||||
// set the bytes of the buffer to the correct values
|
|
||||||
for (let i = 0; i < byteString.length; i++) {
|
for (let i = 0; i < byteString.length; i++) {
|
||||||
ia[i] = byteString.charCodeAt(i)
|
ia[i] = byteString.charCodeAt(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
// write the ArrayBuffer to a blob, and you're done
|
return new Blob([ ab ], { type: mimeString })
|
||||||
const blob = new Blob([ ab ], { type: mimeString })
|
|
||||||
return blob
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// End Section - Upload
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
</my-help>
|
</my-help>
|
||||||
|
|
||||||
<my-markdown-textarea
|
<my-markdown-textarea
|
||||||
formControlName="description" [markdownVideo]="videoToUpdate"
|
formControlName="description" [markdownVideo]="publishedVideo"
|
||||||
[formError]="formErrors.description" [truncateTo3Lines]="true"
|
[formError]="formErrors.description" [truncateTo3Lines]="true"
|
||||||
></my-markdown-textarea>
|
></my-markdown-textarea>
|
||||||
</div>
|
</div>
|
||||||
@ -252,7 +252,7 @@
|
|||||||
|
|
||||||
<my-timestamp-input
|
<my-timestamp-input
|
||||||
class="d-block" [disableBorder]="false" [inputName]="'timecode[' + i + ']'"
|
class="d-block" [disableBorder]="false" [inputName]="'timecode[' + i + ']'"
|
||||||
[maxTimestamp]="videoToUpdate?.duration" formControlName="timecode"
|
[maxTimestamp]="publishedVideo?.duration" formControlName="timecode"
|
||||||
></my-timestamp-input>
|
></my-timestamp-input>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@ -276,7 +276,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<my-embed *ngIf="videoToUpdate" class="col-md-12 col-xl-6" [video]="videoToUpdate"></my-embed>
|
<my-embed *ngIf="publishedVideo" class="col-md-12 col-xl-6" [video]="publishedVideo"></my-embed>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@ -375,7 +375,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label i18n for="previewfile">Video thumbnail</label>
|
<label i18n for="previewfile">Video thumbnail</label>
|
||||||
|
|
||||||
<my-thumbnail-manager id="previewfile" formControlName="previewfile" [uuid]="videoToUpdate.uuid"></my-thumbnail-manager>
|
<my-thumbnail-manager id="previewfile" formControlName="previewfile" [video]="publishedVideo"></my-thumbnail-manager>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -119,7 +119,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
|
|||||||
@Input() formErrors: FormReactiveErrors & { chapters?: { title: string }[] } = {}
|
@Input() formErrors: FormReactiveErrors & { chapters?: { title: string }[] } = {}
|
||||||
@Input() validationMessages: FormReactiveValidationMessages = {}
|
@Input() validationMessages: FormReactiveValidationMessages = {}
|
||||||
|
|
||||||
@Input() videoToUpdate: VideoDetails
|
@Input() publishedVideo: VideoDetails
|
||||||
|
|
||||||
@Input() userVideoChannels: SelectChannelItem[] = []
|
@Input() userVideoChannels: SelectChannelItem[] = []
|
||||||
@Input() forbidScheduledPublication = true
|
@Input() forbidScheduledPublication = true
|
||||||
@ -418,7 +418,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
return pluginField.commonOptions.hidden({
|
return pluginField.commonOptions.hidden({
|
||||||
formValues: this.form.value,
|
formValues: this.form.value,
|
||||||
videoToUpdate: this.videoToUpdate,
|
videoToUpdate: this.publishedVideo,
|
||||||
liveVideo: this.liveVideo
|
liveVideo: this.liveVideo
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
|
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
|
||||||
[videoCaptions]="videoCaptions" [hideWaitTranscoding]="isWaitTranscodingHidden()"
|
[videoCaptions]="videoCaptions" [hideWaitTranscoding]="isWaitTranscodingHidden()"
|
||||||
type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()"
|
type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()"
|
||||||
[liveVideo]="liveVideo" [videoToUpdate]="videoDetails"
|
[liveVideo]="liveVideo" [publishedVideo]="videoDetails"
|
||||||
[videoSource]="videoSource" [updateVideoFileEnabled]="isUpdateVideoFileEnabled()"
|
[videoSource]="videoSource" [updateVideoFileEnabled]="isUpdateVideoFileEnabled()"
|
||||||
|
|
||||||
(formBuilt)="onFormBuilt()"
|
(formBuilt)="onFormBuilt()"
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { environment } from 'src/environments/environment'
|
import { environment } from 'src/environments/environment'
|
||||||
import { Component, Input, OnInit } from '@angular/core'
|
import { Component, ElementRef, Input, OnInit, booleanAttribute } from '@angular/core'
|
||||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
|
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
|
||||||
import { buildVideoOrPlaylistEmbed } from '@root-helpers/video'
|
import { buildVideoOrPlaylistEmbed } from '@root-helpers/video'
|
||||||
import { buildVideoEmbedLink, decorateVideoLink } from '@peertube/peertube-core-utils'
|
import { buildVideoEmbedLink, decorateVideoLink } from '@peertube/peertube-core-utils'
|
||||||
import { Video } from '@peertube/peertube-models'
|
import { Video } from '@peertube/peertube-models'
|
||||||
|
|
||||||
|
export type EmbedVideoInput = Pick<Video, 'name' | 'uuid'> & Partial<Pick<Video, 'aspectRatio'>>
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-embed',
|
selector: 'my-embed',
|
||||||
styleUrls: [ './embed.component.scss' ],
|
styleUrls: [ './embed.component.scss' ],
|
||||||
@ -12,11 +14,17 @@ import { Video } from '@peertube/peertube-models'
|
|||||||
standalone: true
|
standalone: true
|
||||||
})
|
})
|
||||||
export class EmbedComponent implements OnInit {
|
export class EmbedComponent implements OnInit {
|
||||||
@Input({ required: true }) video: Pick<Video, 'name' | 'uuid'> & Partial<Pick<Video, 'aspectRatio'>>
|
@Input({ required: true }) video: EmbedVideoInput
|
||||||
|
@Input({ transform: booleanAttribute }) enableAPI: boolean
|
||||||
|
@Input({ transform: booleanAttribute }) mute: boolean
|
||||||
|
@Input({ transform: booleanAttribute }) autoplay: boolean
|
||||||
|
|
||||||
embedHTML: SafeHtml
|
embedHTML: SafeHtml
|
||||||
|
|
||||||
constructor (private sanitizer: DomSanitizer) {
|
constructor (
|
||||||
|
private sanitizer: DomSanitizer,
|
||||||
|
private el: ElementRef
|
||||||
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +34,10 @@ export class EmbedComponent implements OnInit {
|
|||||||
url: buildVideoEmbedLink(this.video, environment.originServerUrl),
|
url: buildVideoEmbedLink(this.video, environment.originServerUrl),
|
||||||
|
|
||||||
title: false,
|
title: false,
|
||||||
warningTitle: false
|
warningTitle: false,
|
||||||
|
api: this.enableAPI,
|
||||||
|
muted: this.mute,
|
||||||
|
autoplay: this.autoplay
|
||||||
}),
|
}),
|
||||||
embedTitle: this.video.name,
|
embedTitle: this.video.name,
|
||||||
aspectRatio: this.video.aspectRatio
|
aspectRatio: this.video.aspectRatio
|
||||||
@ -34,4 +45,8 @@ export class EmbedComponent implements OnInit {
|
|||||||
|
|
||||||
this.embedHTML = this.sanitizer.bypassSecurityTrustHtml(html)
|
this.embedHTML = this.sanitizer.bypassSecurityTrustHtml(html)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIframe () {
|
||||||
|
return (this.el.nativeElement as HTMLElement).querySelector('iframe')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,8 @@ function decorateVideoLink (options: {
|
|||||||
|
|
||||||
peertubeLink?: boolean
|
peertubeLink?: boolean
|
||||||
p2p?: boolean
|
p2p?: boolean
|
||||||
|
|
||||||
|
api?: boolean
|
||||||
}) {
|
}) {
|
||||||
const { url } = options
|
const { url } = options
|
||||||
|
|
||||||
@ -113,6 +115,8 @@ function decorateVideoLink (options: {
|
|||||||
if (options.peertubeLink === false) params.set('peertubeLink', '0')
|
if (options.peertubeLink === false) params.set('peertubeLink', '0')
|
||||||
if (options.p2p !== undefined) params.set('p2p', options.p2p ? '1' : '0')
|
if (options.p2p !== undefined) params.set('p2p', options.p2p ? '1' : '0')
|
||||||
|
|
||||||
|
if (options.api !== undefined) params.set('api', options.api ? '1' : '0')
|
||||||
|
|
||||||
return buildUrl(url, params)
|
return buildUrl(url, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user