livephoto: add video download button

pull/231/head
Varun Patil 2022-11-22 06:27:10 -08:00
parent a2af575073
commit c3ddd4087f
2 changed files with 23 additions and 1 deletions

View File

@ -178,9 +178,13 @@ class VideoController extends ApiBase
if ($liveFile instanceof File) {
// Create and send response
$name = $liveFile->getName();
$blob = $liveFile->getContent();
$response = new DataDisplayResponse($blob, Http::STATUS_OK, [
$response = new DataDisplayResponse($blob, Http::STATUS_OK, []);
$response->setHeaders([
'Content-Type' => $liveFile->getMimeType(),
'Content-Disposition' => "attachment; filename=\"$name\"",
]);
$response->cacheFor(3600 * 24, false, false);

View File

@ -86,6 +86,17 @@
<DownloadIcon :size="24" />
</template>
</NcActionButton>
<NcActionButton
v-if="currentPhoto.liveid"
:aria-label="t('memories', 'Download Video')"
@click="downloadCurrentLiveVideo"
:close-after-click="true"
>
{{ t("memories", "Download Video") }}
<template #icon>
<DownloadIcon :size="24" />
</template>
</NcActionButton>
<NcActionButton
v-if="!routeIsPublic"
:aria-label="t('memories', 'View in folder')"
@ -795,6 +806,13 @@ export default class Viewer extends Mixins(GlobalMixin) {
dav.downloadFilesByPhotos([photo]);
}
/** Download live part of current video */
private async downloadCurrentLiveVideo() {
const photo = this.currentPhoto;
if (!photo) return;
window.location.href = utils.getLivePhotoVideoUrl(photo);
}
/** Open the sidebar */
private async openSidebar(photo?: IPhoto) {
const fInfo = await dav.getFiles([photo || this.currentPhoto]);