share: enable sharing smaller videos

Signed-off-by: Varun Patil <radialapps@gmail.com>
dexie
Varun Patil 2023-09-30 11:37:40 -07:00
parent 23d54d3f3b
commit 5fac290b37
4 changed files with 18 additions and 12 deletions

View File

@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
- **Feature**: View file in folder on clicking name in sidebar
- **Feature**: User can leave albums that are shared with them
- **Feature**: Admin can now configure default behavior of loading high resolution image in viewer ([#672](https://github.com/pulsejet/memories/pull/672))
- **Feature**: Shared videos will now be transcoded to be smaller in size
- **Fix**: Support for transcoding MKV files.
## [v5.4.1] - 2023-08-20

View File

@ -206,7 +206,7 @@ class VideoController extends GenericApiController
// If this is H.264 it won't get transcoded anyway
if ($liveVideoPath) {
return Util::guardExDirect(function ($out) use ($transcode, $liveVideoPath) {
$this->getUpstream($transcode, $liveVideoPath, 'max.mov');
$this->getUpstream($transcode, $liveVideoPath, 'max.mp4');
});
}
}

View File

@ -9,7 +9,7 @@ use OCA\Memories\Util;
class BinExt
{
public const EXIFTOOL_VER = '12.60';
public const GOVOD_VER = '0.1.14';
public const GOVOD_VER = '0.1.15';
public const NX_VER_MIN = '1.0';
/** Copy a binary to temp dir for execution */

View File

@ -10,7 +10,7 @@
<ul class="options" v-else>
<NcListItem
v-if="canShareNative && !isVideo && !isLocal"
v-if="canShareNative && canShareTranscode"
:title="t('memories', 'Reduced Size')"
:bold="false"
@click.prevent="sharePreview()"
@ -19,12 +19,16 @@
<PhotoIcon class="avatar" :size="24" />
</template>
<template #subtitle>
{{ t('memories', 'Share a lower resolution image preview') }}
{{
isVideo
? t('memories', 'Share the video as a low quality MP4')
: t('memories', 'Share a lower resolution image preview')
}}
</template>
</NcListItem>
<NcListItem
v-if="canShareNative && canShareHighRes"
v-if="canShareNative && canShareTranscode"
:title="t('memories', 'High Resolution')"
:bold="false"
@click.prevent="shareHighRes()"
@ -35,7 +39,7 @@
<template #subtitle>
{{
isVideo
? t('memories', 'Share the video as a high quality MOV')
? t('memories', 'Share the video as a high quality MP4')
: t('memories', 'Share the image as a high quality JPEG')
}}
</template>
@ -124,7 +128,7 @@ export default defineComponent({
return 'share' in navigator || nativex.has();
},
canShareHighRes(): boolean {
canShareTranscode(): boolean {
return !this.isLocal && (!this.isVideo || !this.config.vod_disable);
},
@ -157,16 +161,17 @@ export default defineComponent({
},
async sharePreview() {
const src = utils.getPreviewUrl({
photo: this.photo!,
size: 2048,
});
const src = this.isVideo
? API.VIDEO_TRANSCODE(this.photo!.fileid, '480p.mp4')
: utils.getPreviewUrl({ photo: this.photo!, size: 2048 });
this.shareWithHref(src, true);
},
async shareHighRes() {
const fileid = this.photo!.fileid;
const src = this.isVideo ? API.VIDEO_TRANSCODE(fileid, 'max.mov') : API.IMAGE_DECODABLE(fileid, this.photo!.etag);
const src = this.isVideo
? API.VIDEO_TRANSCODE(fileid, '1080p.mp4')
: API.IMAGE_DECODABLE(fileid, this.photo!.etag);
this.shareWithHref(src, !this.isVideo);
},