mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 16:42:56 +00:00
feat: add core
This commit is contained in:
155
src/core/things/Video.ts
Normal file
155
src/core/things/Video.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCCreativeWork, SCCreativeWorkWithoutReferences} from '../base/CreativeWork';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCLanguage} from '../types/i18n';
|
||||
import {SCISO8601Duration} from '../types/Time';
|
||||
import {SCPersonWithoutReferences} from './Person';
|
||||
|
||||
/**
|
||||
* Type of a video
|
||||
*/
|
||||
export type SCVideoType = 'video';
|
||||
|
||||
/**
|
||||
* A video without references
|
||||
*/
|
||||
export interface SCVideoWithoutReferences extends SCCreativeWorkWithoutReferences {
|
||||
/**
|
||||
* The Duration of the Video
|
||||
*/
|
||||
duration?: SCISO8601Duration;
|
||||
|
||||
/**
|
||||
* Downloadable/Streamable Files of the Video
|
||||
*/
|
||||
sources?: SCVideoSource[];
|
||||
|
||||
/**
|
||||
* URLs to a thumbnails for the Video
|
||||
*/
|
||||
thumbnails?: string[];
|
||||
|
||||
/**
|
||||
* Track Files for the Video
|
||||
*/
|
||||
tracks?: SCVideoTrack;
|
||||
|
||||
/**
|
||||
* A Transcript of the Video
|
||||
*/
|
||||
transcript?: string;
|
||||
|
||||
/**
|
||||
* Type of an Video
|
||||
*/
|
||||
type: SCVideoType;
|
||||
}
|
||||
|
||||
export interface SCVideoSource {
|
||||
/**
|
||||
* Pixel Height of the Video
|
||||
*/
|
||||
height?: number;
|
||||
|
||||
/**
|
||||
* MIME-Type of the source File
|
||||
*/
|
||||
mimeType: SCVideoMimeType;
|
||||
|
||||
/**
|
||||
* Size of the Video File in bytes
|
||||
*/
|
||||
size?: number;
|
||||
|
||||
/**
|
||||
* URL to the Video File
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* Pixel Width of the Video
|
||||
*/
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export interface SCVideoTrack {
|
||||
/**
|
||||
* Language of the Subtitle
|
||||
*/
|
||||
language: SCLanguage;
|
||||
|
||||
/**
|
||||
* Content Type of the Track File
|
||||
*/
|
||||
type: SCVideoTrackTypes;
|
||||
|
||||
/**
|
||||
* URL to the Track File
|
||||
*/
|
||||
url: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A video
|
||||
*/
|
||||
export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences {
|
||||
/**
|
||||
* Persons acting in the Video
|
||||
*/
|
||||
actors?: SCPersonWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Type of a video
|
||||
*/
|
||||
type: SCVideoType;
|
||||
}
|
||||
|
||||
export class SCVideoMeta extends SCThingMeta {
|
||||
static fieldValueTranslations = {
|
||||
...SCThingMeta.fieldValueTranslations,
|
||||
de: {
|
||||
actors: 'Darsteller',
|
||||
duration: 'Länge',
|
||||
height: 'Höhe',
|
||||
language: 'Sprache',
|
||||
size: 'Größe',
|
||||
sources: 'Quellen',
|
||||
transcript: 'Abschrift',
|
||||
type: 'Video',
|
||||
width: 'Breite',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Video Encoding Formats
|
||||
*/
|
||||
export type SCVideoMimeType =
|
||||
'video/mp4'
|
||||
| 'video/ogg'
|
||||
| 'video/webm'
|
||||
| 'application/vnd.apple.mpegurl'
|
||||
| 'application/dash+xml';
|
||||
|
||||
/**
|
||||
* Video Track Types
|
||||
*/
|
||||
export type SCVideoTrackTypes =
|
||||
'captions'
|
||||
| 'chapters'
|
||||
| 'description'
|
||||
| 'metadata'
|
||||
| 'subtitles';
|
||||
Reference in New Issue
Block a user