diff --git a/client/src/app/videos/+video-watch/modal/video-download.component.html b/client/src/app/videos/+video-watch/modal/video-download.component.html
index d30a49345..316bd635c 100644
--- a/client/src/app/videos/+video-watch/modal/video-download.component.html
+++ b/client/src/app/videos/+video-watch/modal/video-download.component.html
@@ -24,6 +24,11 @@
+
+
+
+
+
diff --git a/client/src/app/videos/+video-watch/modal/video-download.component.ts b/client/src/app/videos/+video-watch/modal/video-download.component.ts
index 12f31b011..2de706e47 100644
--- a/client/src/app/videos/+video-watch/modal/video-download.component.ts
+++ b/client/src/app/videos/+video-watch/modal/video-download.component.ts
@@ -12,7 +12,7 @@ export class VideoDownloadComponent implements OnInit {
@ViewChild('modal') modal: ModalDirective
- downloadType: 'direct' | 'torrent' = 'torrent'
+ downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent'
resolutionId: number | string = -1
constructor () {
@@ -41,7 +41,19 @@ export class VideoDownloadComponent implements OnInit {
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)
}
}
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts
index 6b8bba211..7c9a43ed9 100644
--- a/client/src/assets/player/peertube-player.ts
+++ b/client/src/assets/player/peertube-player.ts
@@ -143,6 +143,13 @@ function addContextMenu (player: any, videoEmbedUrl: string) {
listener: () => {
copyToClipboard(buildVideoEmbed(videoEmbedUrl))
}
+ },
+ {
+ label: player.localize('Copy magnet URI'),
+ listener: function () {
+ const player = this
+ copyToClipboard(player.peertube().getCurrentVideoFile().magnetUri)
+ }
}
]
})