diff options
Diffstat (limited to 'client')
10 files changed, 44 insertions, 9 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index e057e394e..82f467e16 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | |||
@@ -491,6 +491,23 @@ | |||
491 | </my-peertube-checkbox> | 491 | </my-peertube-checkbox> |
492 | </div> | 492 | </div> |
493 | 493 | ||
494 | <ng-container formGroupName="webtorrent"> | ||
495 | <div class="form-group" > | ||
496 | <my-peertube-checkbox | ||
497 | inputName="transcodingWebTorrentEnabled" formControlName="enabled" | ||
498 | i18n-labelText labelText="WebTorrent support enabled" | ||
499 | > | ||
500 | <ng-template ptTemplate="help"> | ||
501 | <ng-container i18n> | ||
502 | <strong>Experimental, we suggest you to not disable webtorrent support for now</strong> | ||
503 | |||
504 | <p>If you also enabled HLS support, it will multiply videos storage by 2</p> | ||
505 | </ng-container> | ||
506 | </ng-template> | ||
507 | </my-peertube-checkbox> | ||
508 | </div> | ||
509 | </ng-container> | ||
510 | |||
494 | <ng-container formGroupName="hls"> | 511 | <ng-container formGroupName="hls"> |
495 | <div class="form-group" > | 512 | <div class="form-group" > |
496 | <my-peertube-checkbox | 513 | <my-peertube-checkbox |
@@ -499,7 +516,7 @@ | |||
499 | > | 516 | > |
500 | <ng-template ptTemplate="help"> | 517 | <ng-template ptTemplate="help"> |
501 | <ng-container i18n> | 518 | <ng-container i18n> |
502 | <strong>Requires ffmpeg >= 4.1 and multiplies videos storage by 2!</strong> | 519 | <strong>Requires ffmpeg >= 4.1</strong> |
503 | 520 | ||
504 | <p>Generate HLS playlists and fragmented MP4 files resulting in a better playback than with the current default player:</p> | 521 | <p>Generate HLS playlists and fragmented MP4 files resulting in a better playback than with the current default player:</p> |
505 | <ul> | 522 | <ul> |
@@ -507,6 +524,8 @@ | |||
507 | <li>Faster playback in particular with long videos</li> | 524 | <li>Faster playback in particular with long videos</li> |
508 | <li>More stable playback (less bugs/infinite loading)</li> | 525 | <li>More stable playback (less bugs/infinite loading)</li> |
509 | </ul> | 526 | </ul> |
527 | |||
528 | <p>If you also enabled WebTorrent support, it will multiply videos storage by 2</p> | ||
510 | </ng-container> | 529 | </ng-container> |
511 | </ng-template> | 530 | </ng-template> |
512 | </my-peertube-checkbox> | 531 | </my-peertube-checkbox> |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index f3fb849bb..8411c4f4f 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -169,6 +169,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
169 | resolutions: {}, | 169 | resolutions: {}, |
170 | hls: { | 170 | hls: { |
171 | enabled: null | 171 | enabled: null |
172 | }, | ||
173 | webtorrent: { | ||
174 | enabled: null | ||
172 | } | 175 | } |
173 | }, | 176 | }, |
174 | autoBlacklist: { | 177 | autoBlacklist: { |
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index 7fb95fe4e..8e76bebb1 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts | |||
@@ -65,6 +65,9 @@ export class ServerService { | |||
65 | enabledResolutions: [], | 65 | enabledResolutions: [], |
66 | hls: { | 66 | hls: { |
67 | enabled: false | 67 | enabled: false |
68 | }, | ||
69 | webtorrent: { | ||
70 | enabled: true | ||
68 | } | 71 | } |
69 | }, | 72 | }, |
70 | avatar: { | 73 | avatar: { |
diff --git a/client/src/app/shared/video/modals/video-download.component.html b/client/src/app/shared/video/modals/video-download.component.html index 935d01330..3619f24e5 100644 --- a/client/src/app/shared/video/modals/video-download.component.html +++ b/client/src/app/shared/video/modals/video-download.component.html | |||
@@ -9,7 +9,7 @@ | |||
9 | <div class="input-group input-group-sm"> | 9 | <div class="input-group input-group-sm"> |
10 | <div class="input-group-prepend peertube-select-container"> | 10 | <div class="input-group-prepend peertube-select-container"> |
11 | <select [(ngModel)]="resolutionId"> | 11 | <select [(ngModel)]="resolutionId"> |
12 | <option *ngFor="let file of video?.files" [value]="file.resolution.id">{{ file.resolution.label }}</option> | 12 | <option *ngFor="let file of getVideoFiles()" [value]="file.resolution.id">{{ file.resolution.label }}</option> |
13 | </select> | 13 | </select> |
14 | </div> | 14 | </div> |
15 | <input #urlInput (click)="urlInput.select()" type="text" class="form-control input-sm readonly" readonly [value]="getLink()" /> | 15 | <input #urlInput (click)="urlInput.select()" type="text" class="form-control input-sm readonly" readonly [value]="getLink()" /> |
diff --git a/client/src/app/shared/video/modals/video-download.component.ts b/client/src/app/shared/video/modals/video-download.component.ts index 4022a11e8..0e9e44de7 100644 --- a/client/src/app/shared/video/modals/video-download.component.ts +++ b/client/src/app/shared/video/modals/video-download.component.ts | |||
@@ -24,12 +24,18 @@ export class VideoDownloadComponent { | |||
24 | private i18n: I18n | 24 | private i18n: I18n |
25 | ) { } | 25 | ) { } |
26 | 26 | ||
27 | getVideoFiles () { | ||
28 | if (!this.video) return [] | ||
29 | |||
30 | return this.video.getFiles() | ||
31 | } | ||
32 | |||
27 | show (video: VideoDetails) { | 33 | show (video: VideoDetails) { |
28 | this.video = video | 34 | this.video = video |
29 | 35 | ||
30 | this.activeModal = this.modalService.open(this.modal) | 36 | this.activeModal = this.modalService.open(this.modal) |
31 | 37 | ||
32 | this.resolutionId = this.video.files[0].resolution.id | 38 | this.resolutionId = this.getVideoFiles()[0].resolution.id |
33 | } | 39 | } |
34 | 40 | ||
35 | onClose () { | 41 | onClose () { |
@@ -45,7 +51,7 @@ export class VideoDownloadComponent { | |||
45 | // HTML select send us a string, so convert it to a number | 51 | // HTML select send us a string, so convert it to a number |
46 | this.resolutionId = parseInt(this.resolutionId.toString(), 10) | 52 | this.resolutionId = parseInt(this.resolutionId.toString(), 10) |
47 | 53 | ||
48 | const file = this.video.files.find(f => f.resolution.id === this.resolutionId) | 54 | const file = this.getVideoFiles().find(f => f.resolution.id === this.resolutionId) |
49 | if (!file) { | 55 | if (!file) { |
50 | console.error('Could not find file with resolution %d.', this.resolutionId) | 56 | console.error('Could not find file with resolution %d.', this.resolutionId) |
51 | return | 57 | return |
diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts index e4d443a06..c2a85d8e8 100644 --- a/client/src/app/shared/video/video-details.model.ts +++ b/client/src/app/shared/video/video-details.model.ts | |||
@@ -55,4 +55,8 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { | |||
55 | hasHlsPlaylist () { | 55 | hasHlsPlaylist () { |
56 | return !!this.getHlsPlaylist() | 56 | return !!this.getHlsPlaylist() |
57 | } | 57 | } |
58 | |||
59 | getFiles () { | ||
60 | if (this.files.length === 0) return this.getHlsPlaylist().files | ||
61 | } | ||
58 | } | 62 | } |
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts index 81c66ff20..6ec187f40 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts | |||
@@ -56,7 +56,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
56 | 56 | ||
57 | this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE | 57 | this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE |
58 | 58 | ||
59 | const videoFiles = (video as VideoDetails).files | 59 | const videoFiles = (video as VideoDetails).getFiles() |
60 | if (videoFiles.length > 1) { // Already transcoded | 60 | if (videoFiles.length > 1) { // Already transcoded |
61 | this.waitTranscodingEnabled = false | 61 | this.waitTranscodingEnabled = false |
62 | } | 62 | } |
diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html index ac474b427..5b98a7bd4 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.html +++ b/client/src/app/videos/+video-watch/video-watch.component.html | |||
@@ -221,7 +221,7 @@ | |||
221 | </div> | 221 | </div> |
222 | </div> | 222 | </div> |
223 | 223 | ||
224 | <ng-template [ngIf]="video !== null"> | 224 | <ng-container *ngIf="video !== null"> |
225 | <my-video-support #videoSupportModal [video]="video"></my-video-support> | 225 | <my-video-support #videoSupportModal [video]="video"></my-video-support> |
226 | <my-video-share #videoShareModal [video]="video" [videoCaptions]="videoCaptions"></my-video-share> | 226 | <my-video-share #videoShareModal [video]="video" [videoCaptions]="videoCaptions"></my-video-share> |
227 | </ng-template> | 227 | </ng-container> |
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index af4afd456..c78f5b9a2 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -469,7 +469,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
469 | segmentsSha256Url: hlsPlaylist.segmentsSha256Url, | 469 | segmentsSha256Url: hlsPlaylist.segmentsSha256Url, |
470 | redundancyBaseUrls: hlsPlaylist.redundancies.map(r => r.baseUrl), | 470 | redundancyBaseUrls: hlsPlaylist.redundancies.map(r => r.baseUrl), |
471 | trackerAnnounce: this.video.trackerUrls, | 471 | trackerAnnounce: this.video.trackerUrls, |
472 | videoFiles: this.video.files | 472 | videoFiles: hlsPlaylist.files |
473 | } as P2PMediaLoaderOptions | 473 | } as P2PMediaLoaderOptions |
474 | 474 | ||
475 | Object.assign(options, { p2pMediaLoader }) | 475 | Object.assign(options, { p2pMediaLoader }) |
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index 19d2a1d02..896d90de2 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts | |||
@@ -207,7 +207,7 @@ export class PeerTubeEmbed { | |||
207 | segmentsSha256Url: hlsPlaylist.segmentsSha256Url, | 207 | segmentsSha256Url: hlsPlaylist.segmentsSha256Url, |
208 | redundancyBaseUrls: hlsPlaylist.redundancies.map(r => r.baseUrl), | 208 | redundancyBaseUrls: hlsPlaylist.redundancies.map(r => r.baseUrl), |
209 | trackerAnnounce: videoInfo.trackerUrls, | 209 | trackerAnnounce: videoInfo.trackerUrls, |
210 | videoFiles: videoInfo.files | 210 | videoFiles: hlsPlaylist.files |
211 | } as P2PMediaLoaderOptions | 211 | } as P2PMediaLoaderOptions |
212 | }) | 212 | }) |
213 | } | 213 | } |