<input type="radio" name="download" id="download-direct" [(ngModel)]="downloadType" value="direct">
<label i18n for="download-direct">Direct download</label>
</div>
+
+ <div class="peertube-radio-container">
+ <input type="radio" name="download" id="download-magnet" [(ngModel)]="downloadType" value="magnet">
+ <label i18n for="download-magnet">Torrent (magnet)</label>
+ </div>
</div>
<div class="form-group inputs">
@ViewChild('modal') modal: ModalDirective
- downloadType: 'direct' | 'torrent' = 'torrent'
+ downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent'
resolutionId: number | string = -1
constructor () {
return
}
- const link = this.downloadType === 'direct' ? file.fileDownloadUrl : file.torrentDownloadUrl
+ const link = (() => {
+ switch (this.downloadType) {
+ case 'direct': {
+ return file.fileDownloadUrl
+ }
+ case 'torrent': {
+ return file.torrentDownloadUrl
+ }
+ case 'magnet': {
+ return file.magnetUri
+ }
+ }
+ })()
window.location.assign(link)
}
}
listener: () => {
copyToClipboard(buildVideoEmbed(videoEmbedUrl))
}
+ },
+ {
+ label: player.localize('Copy magnet URI'),
+ listener: function () {
+ const player = this
+ copyToClipboard(player.peertube().getCurrentVideoFile().magnetUri)
+ }
}
]
})