mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 09:20:54 +00:00
use blob url for videoMeta (#8285)
Signed-off-by: denis-tingaikin <denis.tingajkin@xored.com>
This commit is contained in:
parent
11b079a1f7
commit
b885d355b0
@ -156,6 +156,18 @@ export function getFileUploadParams (blobId: string, blob: Blob): FileUploadPara
|
||||
return { method, url, headers }
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function getBlobUrl (file: string): string {
|
||||
const fileUrl = getFileUrl(file)
|
||||
const u = new URL(fileUrl)
|
||||
if (u.searchParams.has('file')) {
|
||||
return u.toString()
|
||||
}
|
||||
return fileUrl.split('/').slice(0, -1).join('/')
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
|
@ -2,7 +2,7 @@ import type { Blob, Ref } from '@hcengineering/core'
|
||||
import { concatLink } from '@hcengineering/core'
|
||||
import { getMetadata } from '@hcengineering/platform'
|
||||
|
||||
import { getFileUrl, getCurrentWorkspaceUuid } from './file'
|
||||
import { getFileUrl, getCurrentWorkspaceUuid, getBlobUrl } from './file'
|
||||
import presentation from './plugin'
|
||||
|
||||
export interface PreviewConfig {
|
||||
@ -158,7 +158,12 @@ export async function getVideoMeta (file: string, filename?: string): Promise<Vi
|
||||
try {
|
||||
const response = await fetch(url, { headers: { Authorization: `Bearer ${token}` } })
|
||||
if (response.ok) {
|
||||
return (await response.json()) as VideoMeta
|
||||
const result = (await response.json()) as VideoMeta
|
||||
if (result.hls !== undefined) {
|
||||
result.hls.source = getBlobUrl(result.hls.source ?? '')
|
||||
result.hls.thumbnail = getBlobUrl(result.hls.thumbnail ?? '')
|
||||
}
|
||||
return result
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import { type FileUploadOptions, type FileUploadCallback } from '@hcengineering/
|
||||
import Recorder from './components/Recorder.svelte'
|
||||
import { showPopup } from '@hcengineering/ui'
|
||||
import { type Blob, type Ref } from '@hcengineering/core'
|
||||
import { getFileUrl } from '@hcengineering/presentation'
|
||||
import { getBlobUrl } from '@hcengineering/presentation'
|
||||
|
||||
let recorderOppened = false
|
||||
|
||||
@ -65,12 +65,3 @@ function now (): string {
|
||||
const date = new Date()
|
||||
return date.toLocaleDateString() + ' ' + date.toLocaleTimeString()
|
||||
}
|
||||
|
||||
function getBlobUrl (file: string): string {
|
||||
const fileUrl = getFileUrl(file)
|
||||
const u = new URL(fileUrl)
|
||||
if (u.searchParams.has('file')) {
|
||||
return u.toString()
|
||||
}
|
||||
return fileUrl.split('/').slice(0, -1).join('/')
|
||||
}
|
||||
|
4
services/export/pod-export/config/rig.json
Normal file
4
services/export/pod-export/config/rig.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
|
||||
"rigPackageName": "@hcengineering/platform-rig"
|
||||
}
|
7
services/export/pod-export/jest.config.js
Normal file
7
services/export/pod-export/jest.config.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],
|
||||
roots: ["./src"],
|
||||
coverageReporters: ["text-summary", "html"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user