This repository has been archived by the owner on Aug 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(yttrex): codec configuration for metadata logger ui
- Loading branch information
1 parent
b964e27
commit 1a9eb9a
Showing
2 changed files
with
98 additions
and
17 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,19 +1,68 @@ | ||
import { HubEvent, HubEventBase } from '@shared/extension/models/HubEvent'; | ||
import { HubEvent } from '@shared/extension/models/HubEvent'; | ||
import * as t from 'io-ts'; | ||
|
||
export interface NewVideoEvent extends HubEventBase { | ||
type: 'NewVideo'; | ||
payload: { | ||
type: number | undefined; | ||
element: string; | ||
size: number; | ||
href: string; | ||
randomUUID: string; | ||
}; | ||
} | ||
export const NEW_VIDEO_EVENT = t.literal('NewVideo'); | ||
export type NEW_VIDEO_EVENT = t.TypeOf<typeof NEW_VIDEO_EVENT>; | ||
export const NewVideoEvent = t.type( | ||
{ | ||
type: NEW_VIDEO_EVENT, | ||
payload: t.type( | ||
{ | ||
type: t.string, | ||
element: t.string, | ||
size: t.number, | ||
href: t.string, | ||
html: t.string, | ||
randomUUID: t.string, | ||
feedCounter: t.number, | ||
videoCounter: t.number, | ||
rect: t.type( | ||
{ | ||
height: t.number, | ||
width: t.number, | ||
x: t.number, | ||
y: t.number, | ||
bottom: t.union([t.number, t.undefined]), | ||
left: t.union([t.number, t.undefined]), | ||
right: t.union([t.number, t.undefined]), | ||
top: t.union([t.number, t.undefined]), | ||
}, | ||
'DOMRect' | ||
), | ||
}, | ||
'NewVideoPayload' | ||
), | ||
}, | ||
'NewVideoEvent' | ||
); | ||
export type NewVideoEvent = t.TypeOf<typeof NewVideoEvent>; | ||
|
||
export interface NewLeafEvent extends HubEventBase { | ||
type: 'leaf'; | ||
payload: {}; | ||
} | ||
export const LEAF_EVENT = t.literal('leaf'); | ||
export type LEAF_EVENT = t.TypeOf<typeof LEAF_EVENT>; | ||
export const NewLeafEvent = t.type( | ||
{ | ||
type: LEAF_EVENT, | ||
payload: t.type( | ||
{ | ||
type: t.string, | ||
element: t.string, | ||
size: t.number, | ||
href: t.string, | ||
html: t.string, | ||
randomUUID: t.string, | ||
feedCounter: t.number, | ||
videoCounter: t.number, | ||
}, | ||
'NewVideoPayload' | ||
), | ||
}, | ||
'NewLeafEvent' | ||
); | ||
export type NewLeafEvent = t.TypeOf<typeof NewLeafEvent>; | ||
|
||
export const ContributionEvent = t.union( | ||
[NewVideoEvent, NewLeafEvent], | ||
'ContributionEvent' | ||
); | ||
|
||
export type YTHubEvent = HubEvent | NewVideoEvent | NewLeafEvent; |