mirror of
https://github.com/koush/scrypted.git
synced 2026-02-09 00:39:56 +00:00
core: fix video clip bugs
This commit is contained in:
2
plugins/core/.vscode/settings.json
vendored
2
plugins/core/.vscode/settings.json
vendored
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"scrypted.debugHost": "koushik-mac",
|
||||
"scrypted.debugHost": "127.0.0.1",
|
||||
}
|
||||
4
plugins/core/package-lock.json
generated
4
plugins/core/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.22",
|
||||
"version": "0.1.23",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.22",
|
||||
"version": "0.1.23",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/core",
|
||||
"version": "0.1.22",
|
||||
"version": "0.1.23",
|
||||
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -6,11 +6,11 @@ import { VideoClip } from "@scrypted/types";
|
||||
export async function fetchClipThumbnail(mediaManager: MediaManager, device: VideoClips, clip: VideoClip) {
|
||||
const mo = await device.getVideoClipThumbnail(clip.id);
|
||||
const url = await mediaManager.convertMediaObject(mo, ScryptedMimeTypes.LocalUrl);
|
||||
return new URL(url.toString()).pathname;
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
export async function fetchClipUrl(mediaManager: MediaManager, device: VideoClips, clip: VideoClip) {
|
||||
const mo = await device.getVideoClip(clip.id);
|
||||
const url = await mediaManager.convertMediaObject(mo, ScryptedMimeTypes.LocalUrl);
|
||||
return new URL(url.toString()).pathname;
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
@@ -4,18 +4,8 @@
|
||||
<video :src="playUrl" controls autoplay></video>
|
||||
</v-dialog>
|
||||
|
||||
<v-list-item
|
||||
v-for="(clip, index) in pageClips"
|
||||
:key="clip.id"
|
||||
@click="playClip(clip, index)"
|
||||
>
|
||||
<v-img
|
||||
class="mr-2"
|
||||
:src="pageThumbnails[index]"
|
||||
contain
|
||||
max-height="100px"
|
||||
max-width="100px"
|
||||
>
|
||||
<v-list-item v-for="(clip, index) in pageClips" :key="clip.id" @click="playClip(clip, index)">
|
||||
<v-img class="mr-2" :src="pageThumbnails[index]" contain max-height="100px" max-width="100px">
|
||||
</v-img>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>
|
||||
@@ -61,21 +51,17 @@
|
||||
<v-spacer></v-spacer>
|
||||
<v-dialog v-model="removeAllClipsDialog" v-if="pages" width="unset">
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn v-on="on" small text color="red"
|
||||
><v-icon x-small>fa fa-trash</v-icon></v-btn
|
||||
>
|
||||
<v-btn v-on="on" small text color="red">
|
||||
<v-icon x-small>fa fa-trash</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card>
|
||||
<v-card-title> Delete All Clips? </v-card-title>
|
||||
<v-card-text
|
||||
>Please confirm deletion of all video clips. This action can not be
|
||||
undone.</v-card-text
|
||||
>
|
||||
<v-card-text>Please confirm deletion of all video clips. This action can not be
|
||||
undone.</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small text @click="removeAllClipsDialog = false"
|
||||
>Cancel</v-btn
|
||||
>
|
||||
<v-btn small text @click="removeAllClipsDialog = false">Cancel</v-btn>
|
||||
<v-btn small text color="red" @click="removeAllClips">Delete</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
@@ -88,6 +74,7 @@ import { datePickerLocalTimeToUTC } from "../common/date";
|
||||
import { fetchClipThumbnail, fetchClipUrl } from "../common/videoclip";
|
||||
import RPCInterface from "./RPCInterface.vue";
|
||||
import Vue from "vue";
|
||||
import path from "path";
|
||||
|
||||
export default {
|
||||
mixins: [RPCInterface],
|
||||
@@ -189,7 +176,10 @@ export default {
|
||||
async downloadClip(clip) {
|
||||
const mediaManager = this.$scrypted.mediaManager;
|
||||
const url = await fetchClipUrl(mediaManager, this.device, clip);
|
||||
window.open(url + "?attachment");
|
||||
const a = document.createElement('a');
|
||||
a.setAttribute('href', url);
|
||||
a.setAttribute('download', path.basename(url));
|
||||
a.click();
|
||||
},
|
||||
async removeClip(clip) {
|
||||
this.device.removeVideoClips(clip.id);
|
||||
|
||||
Reference in New Issue
Block a user