-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from vitalygashkov/next
Added extension types to `@streamyx/api`
- Loading branch information
Showing
4 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
export interface Extension { | ||
/** | ||
* Extension name (e.g. Netflix, Prime Video, Apple TV+, etc.) | ||
*/ | ||
name: string; | ||
|
||
/** | ||
* Short tag which will be used in filename (e.g. NF, AMZN, ATVP, etc.) | ||
*/ | ||
tag?: string; | ||
|
||
/** | ||
* Logo icon URL | ||
*/ | ||
icon?: string; | ||
|
||
/** | ||
* Substring pattern to match URL host handled by this plugin | ||
*/ | ||
match?: string; | ||
|
||
/** | ||
* Performs initialization of extension (e.g. loading auth data from storage or token refresh) | ||
*/ | ||
init?: () => void | Promise<void>; | ||
|
||
/** | ||
* Fetches content metadata from URL | ||
*/ | ||
fetchContentMetadata: ( | ||
url: string, | ||
options: Options, | ||
) => Promise<ContentMetadata[]>; | ||
|
||
/** | ||
* Fetches data about content source (e.g. manifest URL, external subtitles, etc.) | ||
*/ | ||
fetchContentSource?: ( | ||
contentId: string, | ||
options: Options, | ||
) => Promise<ContentSource | null>; | ||
|
||
/** | ||
* Fetches just content DRM config (e.g. license server URL, request headers, etc.) | ||
*/ | ||
fetchContentDrm?: (payload: any, options: Options) => Promise<DrmConfig>; | ||
} | ||
|
||
export interface CommonContentMetadata { | ||
tag?: string; | ||
/** | ||
* Required if no `fetchContentSource` method is provided | ||
*/ | ||
source?: ContentSource; | ||
} | ||
|
||
export interface MovieMetadata extends CommonContentMetadata { | ||
id?: string; | ||
title?: string; | ||
} | ||
|
||
export interface EpisodeMetadata extends CommonContentMetadata { | ||
id?: string; | ||
title?: string; | ||
episodeNumber: number; | ||
seasonNumber?: number; | ||
episodeTitle?: string; | ||
} | ||
|
||
export type ContentMetadata = MovieMetadata | EpisodeMetadata; | ||
|
||
export type ContentSource = { | ||
/** | ||
* URL of the content: manifest URL / playlist URL / direct link to media file | ||
*/ | ||
url: string; | ||
headers?: Record<string, string>; | ||
http2?: boolean; | ||
type?: 'video' | 'audio' | 'subtitle' | 'any'; | ||
audioLanguage?: string; | ||
audioType?: string; | ||
subtitles?: any[]; | ||
drm?: DrmConfig; | ||
}; | ||
|
||
export type DrmConfig = | ||
| { | ||
server: string; | ||
headers?: Record<string, string>; | ||
params?: object; | ||
template?: string; | ||
http2?: boolean; | ||
} | ||
| { payload: any }; |