]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Disable webtorrent support in client
authorChocobozzz <me@florianbigard.com>
Thu, 21 Nov 2019 16:01:24 +0000 (17:01 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 25 Nov 2019 09:59:46 +0000 (10:59 +0100)
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
client/src/app/core/server/server.service.ts
client/src/app/shared/video/modals/video-download.component.html
client/src/app/shared/video/modals/video-download.component.ts
client/src/app/shared/video/video-details.model.ts
client/src/app/videos/+video-edit/video-update.component.ts
client/src/app/videos/+video-watch/video-watch.component.html
client/src/app/videos/+video-watch/video-watch.component.ts
client/src/standalone/videos/embed.ts

index e057e394ecd9549f3cd07f0984d6239f254bd958..82f467e166c37892d1be84d916d8ee050fdc557c 100644 (file)
               </my-peertube-checkbox>
             </div>
 
+            <ng-container formGroupName="webtorrent">
+              <div class="form-group" >
+                <my-peertube-checkbox
+                  inputName="transcodingWebTorrentEnabled" formControlName="enabled"
+                  i18n-labelText labelText="WebTorrent support enabled"
+                >
+                  <ng-template ptTemplate="help">
+                    <ng-container i18n>
+                      <strong>Experimental, we suggest you to not disable webtorrent support for now</strong>
+
+                      <p>If you also enabled HLS support, it will multiply videos storage by 2</p>
+                    </ng-container>
+                  </ng-template>
+                </my-peertube-checkbox>
+              </div>
+            </ng-container>
+
             <ng-container formGroupName="hls">
               <div class="form-group" >
                 <my-peertube-checkbox
                 >
                   <ng-template ptTemplate="help">
                     <ng-container i18n>
-                      <strong>Requires ffmpeg >= 4.1 and multiplies videos storage by 2!</strong>
+                      <strong>Requires ffmpeg >= 4.1</strong>
 
                       <p>Generate HLS playlists and fragmented MP4 files resulting in a better playback than with the current default player:</p>
                       <ul>
                         <li>Faster playback in particular with long videos</li>
                         <li>More stable playback (less bugs/infinite loading)</li>
                       </ul>
+
+                      <p>If you also enabled WebTorrent support, it will multiply videos storage by 2</p>
                     </ng-container>
                   </ng-template>
                 </my-peertube-checkbox>
index f3fb849bbf438465b4b2ec9e4e10d4f06095386d..8411c4f4f002e99d1dd50f6c69635cf7e2426b77 100644 (file)
@@ -169,6 +169,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
         resolutions: {},
         hls: {
           enabled: null
+        },
+        webtorrent: {
+          enabled: null
         }
       },
       autoBlacklist: {
index 7fb95fe4e963eb6c9471ad5e3aea6c42bf64fafb..8e76bebb1c417dc037b68554568d0ce82a1e21e3 100644 (file)
@@ -65,6 +65,9 @@ export class ServerService {
       enabledResolutions: [],
       hls: {
         enabled: false
+      },
+      webtorrent: {
+        enabled: true
       }
     },
     avatar: {
index 935d013300b8ab91d838cb08d9fa6916e6cb3bb5..3619f24e509a4bbc037458905bc6057dfea84033 100644 (file)
@@ -9,7 +9,7 @@
       <div class="input-group input-group-sm">
         <div class="input-group-prepend peertube-select-container">
           <select [(ngModel)]="resolutionId">
-            <option *ngFor="let file of video?.files" [value]="file.resolution.id">{{ file.resolution.label }}</option>
+            <option *ngFor="let file of getVideoFiles()" [value]="file.resolution.id">{{ file.resolution.label }}</option>
           </select>
         </div>
         <input #urlInput (click)="urlInput.select()" type="text" class="form-control input-sm readonly" readonly [value]="getLink()" />
index 4022a11e847d58114b3ef308729f0c1be7fc22ec..0e9e44de7c7e52fea659f2ad5dc2eb507cf24e73 100644 (file)
@@ -24,12 +24,18 @@ export class VideoDownloadComponent {
     private i18n: I18n
   ) { }
 
+  getVideoFiles () {
+    if (!this.video) return []
+
+    return this.video.getFiles()
+  }
+
   show (video: VideoDetails) {
     this.video = video
 
     this.activeModal = this.modalService.open(this.modal)
 
-    this.resolutionId = this.video.files[0].resolution.id
+    this.resolutionId = this.getVideoFiles()[0].resolution.id
   }
 
   onClose () {
@@ -45,7 +51,7 @@ export class VideoDownloadComponent {
     // HTML select send us a string, so convert it to a number
     this.resolutionId = parseInt(this.resolutionId.toString(), 10)
 
-    const file = this.video.files.find(f => f.resolution.id === this.resolutionId)
+    const file = this.getVideoFiles().find(f => f.resolution.id === this.resolutionId)
     if (!file) {
       console.error('Could not find file with resolution %d.', this.resolutionId)
       return
index e4d443a06ae88f5bed879946b92e1580c447ef29..c2a85d8e8bcc248d3526e6864acaa362d9774d2f 100644 (file)
@@ -55,4 +55,8 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
   hasHlsPlaylist () {
     return !!this.getHlsPlaylist()
   }
+
+  getFiles () {
+    if (this.files.length === 0) return this.getHlsPlaylist().files
+  }
 }
index 81c66ff209878d42230380bfaf35da34f4e94deb..6ec187f401837789fe0c5c30707caf9042cd7b28 100644 (file)
@@ -56,7 +56,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
 
           this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE
 
-          const videoFiles = (video as VideoDetails).files
+          const videoFiles = (video as VideoDetails).getFiles()
           if (videoFiles.length > 1) { // Already transcoded
             this.waitTranscodingEnabled = false
           }
index ac474b4275ec3e3fed5f42b299e285880c4385a0..5b98a7bd48e4a1a164a76d7400f59e8477d32aea 100644 (file)
   </div>
 </div>
 
-<ng-template [ngIf]="video !== null">
+<ng-container *ngIf="video !== null">
   <my-video-support #videoSupportModal [video]="video"></my-video-support>
   <my-video-share #videoShareModal [video]="video" [videoCaptions]="videoCaptions"></my-video-share>
-</ng-template>
+</ng-container>
index af4afd456073146343daf44fd880a51fd6fe5ec8..c78f5b9a2291cc318649047dbd132e91944cce46 100644 (file)
@@ -469,7 +469,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
         segmentsSha256Url: hlsPlaylist.segmentsSha256Url,
         redundancyBaseUrls: hlsPlaylist.redundancies.map(r => r.baseUrl),
         trackerAnnounce: this.video.trackerUrls,
-        videoFiles: this.video.files
+        videoFiles: hlsPlaylist.files
       } as P2PMediaLoaderOptions
 
       Object.assign(options, { p2pMediaLoader })
index 19d2a1d023d73fb29a3c92c6e8790e656784c1eb..896d90de28859cd22ed6d06e3267fccda4f083c6 100644 (file)
@@ -207,7 +207,7 @@ export class PeerTubeEmbed {
           segmentsSha256Url: hlsPlaylist.segmentsSha256Url,
           redundancyBaseUrls: hlsPlaylist.redundancies.map(r => r.baseUrl),
           trackerAnnounce: videoInfo.trackerUrls,
-          videoFiles: videoInfo.files
+          videoFiles: hlsPlaylist.files
         } as P2PMediaLoaderOptions
       })
     }