Fixed bug where subscription videos could not be downloaded from the player

This commit is contained in:
Isaac Grynsztein
2020-04-07 19:16:15 -04:00
parent fa488015c3
commit 720fceefb6
3 changed files with 23 additions and 8 deletions

View File

@@ -250,7 +250,7 @@ export class PlayerComponent implements OnInit {
const ext = (this.type === 'audio') ? '.mp3' : '.mp4';
const filename = this.playlist[0].title;
this.downloading = true;
this.postsService.downloadFileFromServer(filename, this.type).subscribe(res => {
this.postsService.downloadFileFromServer(filename, this.type, null, null, this.subscriptionName, this.subPlaylist).subscribe(res => {
this.downloading = false;
const blob: Blob = res;
saveAs(blob, filename + ext);

View File

@@ -122,12 +122,15 @@ export class PostsService {
return this.http.post(this.path + 'getFile', {uid: uid, type: type});
}
downloadFileFromServer(fileName, type, outputName = null, fullPathProvided = null) {
downloadFileFromServer(fileName, type, outputName = null, fullPathProvided = null, subscriptionName = null, subPlaylist = null) {
return this.http.post(this.path + 'downloadFile', {fileNames: fileName,
type: type,
zip_mode: Array.isArray(fileName),
outputName: outputName,
fullPathProvided: fullPathProvided},
fullPathProvided: fullPathProvided,
subscriptionName: subscriptionName,
subPlaylist: subPlaylist
},
{responseType: 'blob'});
}