From 092092969633bbcf6d4891a083ea497a7d5c3154 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 29 Jan 2019 08:37:25 +0100 Subject: Add hls support on server --- .../activitypub/objects/cache-file-object.ts | 4 +- .../models/activitypub/objects/common-objects.ts | 60 +++++++++++++++------- 2 files changed, 43 insertions(+), 21 deletions(-) (limited to 'shared/models/activitypub') diff --git a/shared/models/activitypub/objects/cache-file-object.ts b/shared/models/activitypub/objects/cache-file-object.ts index 0a5125f5b..4b0a3a724 100644 --- a/shared/models/activitypub/objects/cache-file-object.ts +++ b/shared/models/activitypub/objects/cache-file-object.ts @@ -1,9 +1,9 @@ -import { ActivityVideoUrlObject } from './common-objects' +import { ActivityVideoUrlObject, ActivityPlaylistUrlObject } from './common-objects' export interface CacheFileObject { id: string type: 'CacheFile', object: string expires: string - url: ActivityVideoUrlObject + url: ActivityVideoUrlObject | ActivityPlaylistUrlObject } diff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.ts index 118a4f43d..8c89810d6 100644 --- a/shared/models/activitypub/objects/common-objects.ts +++ b/shared/models/activitypub/objects/common-objects.ts @@ -28,25 +28,47 @@ export type ActivityVideoUrlObject = { fps: number } -export type ActivityUrlObject = - ActivityVideoUrlObject - | - { - type: 'Link' - // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) - mimeType?: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' - mediaType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' - href: string - height: number - } - | - { - type: 'Link' - // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) - mimeType?: 'text/html' - mediaType: 'text/html' - href: string - } +export type ActivityPlaylistSegmentHashesObject = { + type: 'Link' + name: 'sha256' + // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) + mimeType?: 'application/json' + mediaType: 'application/json' + href: string +} + +export type ActivityPlaylistInfohashesObject = { + type: 'Infohash' + name: string +} + +export type ActivityPlaylistUrlObject = { + type: 'Link' + // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) + mimeType?: 'application/x-mpegURL' + mediaType: 'application/x-mpegURL' + href: string + tag?: (ActivityPlaylistSegmentHashesObject | ActivityPlaylistInfohashesObject)[] +} + +export type ActivityBitTorrentUrlObject = { + type: 'Link' + // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) + mimeType?: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' + mediaType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet' + href: string + height: number +} + +export type ActivityHtmlUrlObject = { + type: 'Link' + // TODO: remove mimeType (backward compatibility, introduced in v1.1.0) + mimeType?: 'text/html' + mediaType: 'text/html' + href: string +} + +export type ActivityUrlObject = ActivityVideoUrlObject | ActivityPlaylistUrlObject | ActivityBitTorrentUrlObject | ActivityHtmlUrlObject export interface ActivityPubAttributedTo { type: 'Group' | 'Person' -- cgit v1.2.3