mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-08 06:22:53 +00:00
206 lines
3.9 KiB
TypeScript
206 lines
3.9 KiB
TypeScript
/*
|
|
* Copyright (C) 2019 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 {SCLanguage, SCMetaTranslations} from '../general/i18n';
|
|
import {SCISO8601Duration} from '../general/time';
|
|
import {SCCreativeWork, SCCreativeWorkMeta, SCCreativeWorkWithoutReferences} from './abstract/creative-work';
|
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
|
import {SCPersonWithoutReferences} from './person';
|
|
|
|
/**
|
|
* 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
|
|
*
|
|
* @keyword
|
|
*/
|
|
thumbnails?: string[];
|
|
|
|
/**
|
|
* Track Files for the Video
|
|
*/
|
|
tracks?: SCVideoTrack;
|
|
|
|
/**
|
|
* A Transcript of the Video
|
|
*
|
|
* @text
|
|
*/
|
|
transcript?: string;
|
|
|
|
/**
|
|
* Type of an Video
|
|
*/
|
|
type: SCThingType.Video;
|
|
}
|
|
|
|
export interface SCVideoSource {
|
|
/**
|
|
* Pixel Height of the Video
|
|
*
|
|
* @integer
|
|
*/
|
|
height?: number;
|
|
|
|
/**
|
|
* MIME-Type of the source File
|
|
*
|
|
* @filterable
|
|
*/
|
|
mimeType: SCVideoMimeType;
|
|
|
|
/**
|
|
* Size of the Video File in bytes
|
|
*
|
|
* @integer
|
|
*/
|
|
size?: number;
|
|
|
|
/**
|
|
* URL to the Video File
|
|
*
|
|
* @keyword
|
|
*/
|
|
url: string;
|
|
|
|
/**
|
|
* Pixel Width of the Video
|
|
*
|
|
* @integer
|
|
*/
|
|
width?: number;
|
|
}
|
|
|
|
export interface SCVideoTrack {
|
|
/**
|
|
* Language of the Subtitle
|
|
*/
|
|
language: SCLanguage;
|
|
|
|
/**
|
|
* Content Type of the Track File
|
|
*
|
|
* @filterable
|
|
*/
|
|
type: SCVideoTrackTypes;
|
|
|
|
/**
|
|
* URL to the Track File
|
|
*
|
|
* @keyword
|
|
*/
|
|
url: string;
|
|
}
|
|
|
|
/**
|
|
* A video
|
|
*
|
|
* @validatable
|
|
* @indexable
|
|
*/
|
|
export interface SCVideo
|
|
extends SCCreativeWork, SCVideoWithoutReferences {
|
|
/**
|
|
* Persons acting in the Video
|
|
*/
|
|
actors?: SCPersonWithoutReferences[];
|
|
|
|
/**
|
|
* Type of a video
|
|
*/
|
|
type: SCThingType.Video;
|
|
}
|
|
|
|
/**
|
|
* Meta information about a video
|
|
*/
|
|
export class SCVideoMeta
|
|
extends SCThingMeta
|
|
implements SCMetaTranslations<SCVideo> {
|
|
/**
|
|
* Translations of fields
|
|
*/
|
|
fieldTranslations = {
|
|
de: {
|
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
|
.de,
|
|
actors: 'Darsteller',
|
|
duration: 'Dauer',
|
|
sources: 'Quellen',
|
|
thumbnails: 'Vorschaubilder',
|
|
tracks: 'Spuren',
|
|
transcript: 'Transkript',
|
|
},
|
|
en: {
|
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>().fieldTranslations
|
|
.en,
|
|
actors: 'actors',
|
|
duration: 'duration',
|
|
sources: 'sources',
|
|
thumbnails: 'thumbnails',
|
|
tracks: 'tracks',
|
|
transcript: 'transcript',
|
|
},
|
|
};
|
|
|
|
/**
|
|
* Translations of values of fields
|
|
*/
|
|
fieldValueTranslations = {
|
|
de: {
|
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
|
.fieldValueTranslations.de,
|
|
type: 'Video',
|
|
},
|
|
en: {
|
|
...SCCreativeWorkMeta.getInstance<SCCreativeWorkMeta>()
|
|
.fieldValueTranslations.en,
|
|
type: SCThingType.Video,
|
|
},
|
|
};
|
|
}
|
|
|
|
/**
|
|
* 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 =
|
|
'closed captions'
|
|
| 'chapters'
|
|
| 'description'
|
|
| 'metadata'
|
|
| 'subtitles';
|