livephoto: add video download button
parent
a2af575073
commit
c3ddd4087f
|
@ -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);
|
||||
|
||||
|
|
|
@ -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]);
|
||||
|
|
Loading…
Reference in New Issue